Skip to content

Commit

Permalink
Add support for Ubuntu 22.04
Browse files Browse the repository at this point in the history
  • Loading branch information
bd-clara committed Mar 23, 2023
2 parents 6136134 + 12143ae commit ec85ca9
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 41 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ Available variables are listed below, along with default values (see `defaults/m
az_devops_accountname: null
az_devops_accesstoken: null
az_devops_project_name: null
az_devops_agent_version: 2.188.3
az_devops_agent_version: 2.218.1
az_devops_agent_user: "az_devops_agent"
az_devops_agent_group: "az_devops_agent"
az_devops_agent_uid: null
az_devops_agent_gid: null
az_devops_agent_name: "{{ ansible_hostname }}"
az_devops_server_url: "https://dev.azure.com/{{ az_devops_accountname }}"
az_devops_agent_folder: "/home/{{ az_devops_agent_user }}/agent/"
Expand Down Expand Up @@ -69,6 +71,10 @@ Available variables are listed below, along with default values (see `defaults/m
Default group of the user used to run and configure the service.
- **az_devops_agent_gid**
GID of the user group used to run and configure the service.
- **az_devops_agent_name**
Name of the agent shown in Azure DevOps (defaults to the name of the host.).
Expand Down
3 changes: 2 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
az_devops_agent_version: 2.188.3
az_devops_agent_version: 2.218.1
az_devops_agent_user: "az_devops_agent"
az_devops_agent_name: "{{ ansible_hostname }}"
az_devops_server_url: "https://dev.azure.com/{{ az_devops_accountname }}/"
Expand All @@ -18,3 +18,4 @@ az_devops_proxy_url: null
az_devops_proxy_username: null
az_devops_proxy_password: null
az_devops_agent_create_local_user: true
az_devops_agent_legacy_dependencies: []
3 changes: 3 additions & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ galaxy_info:
- xenial
- bionic
- focal
- jammy
- name: EL
versions:
- 7
- 8
- name: Debian
versions:
- stretch
- buster
- bullseye
- name: Windows
versions:
- 2016
Expand Down
31 changes: 21 additions & 10 deletions tasks/Darwin.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
- name: Add an agent group {{ az_devops_agent_group }}
ansible.builtin.group:
name: "{{ az_devops_agent_group }}"
gid: "{{ az_devops_agent_gid|default(omit) }}"
state: present
become: true

- name: Add an agent user
ansible.builtin.user:
name: "{{ az_devops_agent_user }}"
Expand Down Expand Up @@ -89,17 +96,21 @@

- name: Add deployment group tags
ansible.builtin.set_fact:
deployment_agent_cmd_args: "{{ deployment_agent_cmd_args }} +
['--addDeploymentGroupTags', '--deploymentGroupTags \\'{{ az_devops_deployment_group_tags }}\\'']"
deployment_agent_cmd_args: "{{ deployment_agent_cmd_args + ['--addDeploymentGroupTags', '--deploymentGroupTags', az_devops_deployment_group_tags] }}"
when:
- az_devops_deployment_group_tags is defined and az_devops_deployment_group_tags != None

- name: Set proxy url
ansible.builtin.set_fact:
agent_cmd_args: "{{ agent_cmd_args + ['--proxyurl', az_devops_proxy_url] }}"
when:
- az_devops_deployment_group_tags is defined
- az_devops_proxy_url is defined and az_devops_proxy_url != None

- name: Set proxy
- name: Set proxy username and password
ansible.builtin.set_fact:
agent_cmd_args: "{{ agent_cmd_args }} + ['--proxyurl \\'{{ az_devops_proxy_url }}\\'',
'--proxyusername \\'{{ az_devops_proxy_username }}\\'', '--proxypassword \\'{{ az_devops_proxy_password }}\\'']"
agent_cmd_args: "{{ agent_cmd_args + ['--proxyusername', az_devops_proxy_username, '--proxypassword', az_devops_proxy_password] }}"
when:
- az_devops_proxy_url is defined
- az_devops_proxy_url is defined and az_devops_proxy_url != None and az_devops_proxy_username != None and az_devops_proxy_password != None

- name: Uninstall agent service
ansible.builtin.command: ./svc.sh uninstall
Expand All @@ -125,9 +136,9 @@

- name: Add '--replace' configuration argument
ansible.builtin.set_fact:
build_agent_cmd_args: "{{ build_agent_cmd_args }} + ['--replace']"
deployment_agent_cmd_args: "{{ build_agent_cmd_args }} + ['--replace']"
resource_agent_cmd_args: "{{ resource_agent_cmd_args }} + ['--replace']"
build_agent_cmd_args: "{{ build_agent_cmd_args + ['--replace'] }}"
deployment_agent_cmd_args: "{{ build_agent_cmd_args + ['--replace'] }}"
resource_agent_cmd_args: "{{ resource_agent_cmd_args + ['--replace'] }}"
when:
- az_devops_agent_replace_existing

Expand Down
44 changes: 27 additions & 17 deletions tasks/Linux.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
- name: Add an agent user group
- name: Add an agent group {{ az_devops_agent_group }}
ansible.builtin.group:
name: "{{ az_devops_agent_group }}"
gid: "{{ az_devops_agent_gid|default(omit) }}"
state: present
become: true

- name: Add an agent user
ansible.builtin.user:
Expand All @@ -14,7 +14,7 @@
become: true

- name: Create directories
ansible.bulitin.file:
ansible.builtin.file:
state: directory
path: "{{ item }}"
owner: "{{ az_devops_agent_user }}"
Expand Down Expand Up @@ -113,21 +113,31 @@
reconfigure_or_replace: "{{ az_devops_reconfigure_agent or az_devops_agent_replace_existing or not is_requested_version }}"

- name: Add deployment group tags
ansible.builtin.set_fact:
deployment_agent_cmd_args: "{{ deployment_agent_cmd_args }} +
['--addDeploymentGroupTags', '--deploymentGroupTags \\'{{ az_devops_deployment_group_tags }}\\'']"
set_fact:
deployment_agent_cmd_args: "{{ deployment_agent_cmd_args + ['--addDeploymentGroupTags', '--deploymentGroupTags', az_devops_deployment_group_tags ] }}"
when:
- az_devops_deployment_group_tags is defined
- az_devops_deployment_group_tags is defined and az_devops_deployment_group_tags != None

- name: Set proxy
ansible.builtin.set_fact:
agent_cmd_args: "{{ agent_cmd_args }} + ['--proxyurl \\'{{ az_devops_proxy_url }}\\'', '--proxyusername \\'{{ az_devops_proxy_username }}\\'', '--proxypassword \\'{{ az_devops_proxy_password }}\\'']"
- name: Set proxy url
set_fact:
agent_cmd_args: "{{ agent_cmd_args + ['--proxyurl', az_devops_proxy_url] }}"
when:
- az_devops_proxy_url is defined
- az_devops_proxy_url is defined and az_devops_proxy_url != None

- name: Set proxy user and password
set_fact:
agent_cmd_args: "{{ agent_cmd_args + ['--proxyusername', az_devops_proxy_username, '--proxypassword', az_devops_proxy_password ] }}"
when:
- az_devops_proxy_url is defined and az_devops_proxy_url != None and az_devops_proxy_username != None and az_devops_proxy_password != None

- name: Download {{ az_devops_agent_package_url }}
get_url:
url: "{{ az_devops_agent_package_url }}"
dest: "/tmp/az_devops_agent_package.tar.gz"

- name: Download and unarchive
ansible.builtin.unarchive:
src: "{{ az_devops_agent_package_url }}"
- name: Unarchive /tmp/az_devops_agent_package.tar.gz
unarchive:
src: "/tmp/az_devops_agent_package.tar.gz"
dest: "{{ az_devops_agent_folder }}"
remote_src: yes
owner: "{{ az_devops_agent_user }}"
Expand Down Expand Up @@ -159,9 +169,9 @@

- name: Add '--replace' configuration argument
ansible.builtin.set_fact:
build_agent_cmd_args: "{{ build_agent_cmd_args }} + ['--replace']"
deployment_agent_cmd_args: "{{ build_agent_cmd_args }} + ['--replace']"
resource_agent_cmd_args: "{{ resource_agent_cmd_args }} + ['--replace']"
build_agent_cmd_args: "{{ build_agent_cmd_args + ['--replace'] }}"
deployment_agent_cmd_args: "{{ build_agent_cmd_args + ['--replace'] }}"
resource_agent_cmd_args: "{{ resource_agent_cmd_args + ['--replace'] }}"
when:
- az_devops_agent_replace_existing

Expand Down
24 changes: 12 additions & 12 deletions tasks/Windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,49 +42,49 @@

- name: Add '/Replace' configuration argument
ansible.builtin.set_fact:
common_install_options: "{{ common_install_options }} + ['/Replace']"
common_install_options: "{{ common_install_options + ['/Replace'] }}"
when:
- az_devops_agent_replace_existing

- name: Add deployment group tags
ansible.builtin.set_fact:
deployment_install_options: "{{ deployment_install_options }} + ['/DeploymentGroupTags:{{ az_devops_deployment_group_tags }}']"
deployment_install_options: "{{ deployment_install_options + ['/DeploymentGroupTags:{{ az_devops_deployment_group_tags }}'] }}"
when:
- az_devops_deployment_group_tags is defined
- az_devops_deployment_group_tags is defined and az_devops_deployment_group_tags != None

- name: Add az_devops_proxy_url
ansible.builtin.set_fact:
common_install_options: "{{ common_install_options }} + ['/ProxyUrl:{{ az_devops_proxy_url }}']"
common_install_options: "{{ common_install_options + ['/ProxyUrl:{{ az_devops_proxy_url }}'] }}"
when:
- az_devops_proxy_url is defined and az_devops_proxy_url
- az_devops_proxy_url is defined and az_devops_proxy_url != None

- name: Add az_devops_proxy_username
ansible.builtin.set_fact:
common_install_options: "{{ common_install_options }} + ['/ProxyUserName:{{ az_devops_proxy_username }}']"
common_install_options: "{{ common_install_options + ['/ProxyUserName:{{ az_devops_proxy_username }}'] }}"
when:
- az_devops_proxy_username is defined and az_devops_proxy_username
- az_devops_proxy_username is defined and az_devops_proxy_username != None

- name: Add az_devops_proxy_password
ansible.builtin.set_fact:
common_install_options: "{{ common_install_options }} + ['/ProxyPassword:{{ az_devops_proxy_password }}']"
common_install_options: "{{ common_install_options + ['/ProxyPassword:{{ az_devops_proxy_password }}'] }}"
when:
- az_devops_proxy_password is defined and az_devops_proxy_password
- az_devops_proxy_password is defined and az_devops_proxy_password != None

- name: Configure agent as a build server
ansible.builtin.set_fact:
az_devops_agent_package_params: "{{ common_install_options }} + {{ build_agent_install_options }}"
az_devops_agent_package_params: "{{ common_install_options + build_agent_install_options }}"
when:
- az_devops_agent_role == 'build'

- name: Configure agent as a deployment server
ansible.builtin.set_fact:
az_devops_agent_package_params: "{{ common_install_options }} + {{ deployment_install_options }}"
az_devops_agent_package_params: "{{ common_install_options + deployment_install_options }}"
when:
- az_devops_agent_role == 'deployment'

- name: Configure agent as an environment resource
ansible.builtin.set_fact:
az_devops_agent_package_params: "{{ common_install_options }} + {{ resource_agent_install_options }}"
az_devops_agent_package_params: "{{ common_install_options + resource_agent_install_options }}"
when:
- az_devops_agent_role == 'resource'

Expand Down
8 changes: 8 additions & 0 deletions vars/dependencies-RedHat-8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
az_devops_agent_dependencies:
- krb5-libs
- libicu
- lttng-ust
- openssl-libs
- zlib
# mine only found the script install libicu lttng-ust userspace-rcu
- userspace-rcu

0 comments on commit ec85ca9

Please sign in to comment.