Open dendle opened 2 years ago
I also get this same error when deploying to RHEL 8.
After doing some debugging, I have noticed that the Set Proxy task is trying to append lists together but for some reason, its converting it to a string. I commented out the Set Proxy tasks and was able to get past the error. Not sure why Ansible is making the string conversion. more toubleshooting will be required to figure out how to fix this but if you don't depend on the proxy step, comment it out on your downloaded tasks.
- name: Set proxy
set_fact:
agent_cmd_args: "{{ agent_cmd_args }} + ['--proxyurl \\'{{ az_devops_proxy_url }}\\'', '--proxyusername \\'{{ az_devops_proxy_username }}\\'', '--proxypassword \\'{{ az_devops_proxy_password }}\\'']"
when:
- az_devops_proxy_url is defined
I have exactly the same error, CentOS 8 and ansible 2.13.3 and you?
Same for me. Looks like adding lists should be moved inside the {{ }}
. At least according to the Jinja2 docs
However, this might also need native types as formulated here
Digging deeper into this.
Ansible / Jinja2 is not really meant to be juggling with dynamic argument lists. Also there is lots of redundant duplications in the respective tasks (darwin, linux, windows).
A working configuration for proxy facts :
- name: Set proxy
block:
- name: Set proxy facts
ansible.builtin.set_fact:
agent_proxy_args:
- "--proxyurl + '{{ az_devops_proxy_url }}'"
- "--proxyusername + '{{ az_devops_proxy_username }}'"
- "--proxypassword + '{{ az_devops_proxy_password }}'"
- name: Append proxy configuration to agent commands
ansible.builtin.set_fact:
agent_cmd_args: "{{ agent_cmd_args + agent_proxy_args }}"
when:
- az_devops_proxy_url is not none
I used the above suggestion for others:
#...
- name: Set Agent config facts combined
set_fact:
build_server_cmd_args: "{{ agent_cmd_args + build_agent_cmd_args }}"
deployment_server_cmd_args: "{{ agent_cmd_args + deployment_agent_cmd_args }}"
resource_server_cmd_args: "{{ agent_cmd_args + resource_agent_cmd_args }}"
#...
- name: Configure agent as a build server
command: "{{ build_server_cmd_args | join(' ') }}"
args:
chdir: "{{ az_devops_agent_folder }}"
creates: "{{ az_devops_agent_folder }}/.agent"
become: true
become_user: "{{ az_devops_agent_user }}"
when:
- az_devops_agent_role == 'build'
- (not service_is_installed) or reconfigure_or_replace
- name: Configure agent as a deployment server
command: "{{ deployment_server_cmd_args | join(' ') }}"
args:
chdir: "{{ az_devops_agent_folder }}"
creates: "{{ az_devops_agent_folder }}/.agent"
become: true
become_user: "{{ az_devops_agent_user }}"
when:
- az_devops_agent_role == 'deployment'
- (not service_is_installed) or reconfigure_or_replace
- name: Configure agent as an environment resource
command: "{{ resource_server_cmd_args | join(' ') }}"
args:
chdir: "{{ az_devops_agent_folder }}"
creates: "{{ az_devops_agent_folder }}/.agent"
become: true
become_user: "{{ az_devops_agent_user }}"
when:
- az_devops_agent_role == 'resource'
- (not service_is_installed) or reconfigure_or_replace
Hello All,
I get the following error when running this role on ubuntu-focal-20.04.
It appears to be concatenating two lists, which are properly defined - I have no idea whats wrong!
Can anyone help?
Thanks, Matt