Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install multiple agents on 1 server #53

Open
andrescolodrero opened this issue Nov 1, 2021 · 2 comments
Open

Install multiple agents on 1 server #53

andrescolodrero opened this issue Nov 1, 2021 · 2 comments

Comments

@andrescolodrero
Copy link

Playbook could accept an array of agent names, so it is possible to have multiple agents in same server.

Actually, there is no possibility and adding a new name to the variables, will uninstall existing one.

@andrescolodrero
Copy link
Author

Hi,
this will download an create a new folder for a new agent. but it will be nice to have agent_name as an array
az_devops_agent_name: "{{ ansible_hostname }}-agent1"
az_devops_agent_folder: "/home/{{ az_devops_agent_user }}/{{ az_devops_agent_name }}/"
az_devops_work_folder: "/home/{{ az_devops_agent_user }}/{{ az_devops_agent_name }}/_work"

@andrew-sumner
Copy link
Contributor

I've worked around this using the following ansible:

- name: Check for agent service for {{ az_devops_agent_name }}
  ansible.windows.win_service_info:
    name: 'vstsagent.tfs.{{ az_devops_agent_pool_name }}.{{ az_devops_agent_name }}'
  register: service_info

# - debug:
#     var: service_info

# Removing chocolately lib allows installing multiple packages of same version
# See: https://github.com/chocolatey/choco/issues/1022
- name: Remove chocolatly lib folder azure-pipelines-agent.{{ az_devops_agent_version }}
  ansible.windows.win_file:
    path: 'C:\ProgramData\chocolatey\lib\azure-pipelines-agent.{{ az_devops_agent_version }}'
    state: absent
  when: service_info.exists == false or service_info.services[0].state != "started"
 
  # This role https://github.com/gsoft-inc/ansible-role-azure-devops-agent
  # Uses chocolaty package https://community.chocolatey.org/packages/azure-pipelines-agent
- name: Install Azure DevOps Agent {{ az_devops_agent_name }}
  include_role:
    name: gsoft.azure_devops_agent
    allow_duplicates: yes
  when: service_info.exists == false or service_info.services[0].state != "started"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants