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

Error when provisioning build agent - Templating type error #72

Open
dendle opened this issue Nov 16, 2022 · 5 comments
Open

Error when provisioning build agent - Templating type error #72

dendle opened this issue Nov 16, 2022 · 5 comments

Comments

@dendle
Copy link

dendle commented Nov 16, 2022

Hello All,

I get the following error when running this role on ubuntu-focal-20.04.

TASK [gsoft.azure_devops_agent : Configure agent as a build server] ************
fatal: [default]: FAILED! => {"msg": "Unexpected templating type error occurred on ({{ (agent_cmd_args + build_agent_cmd_args) | join(' ') }}): can only concatenate str (not \"list\") to str"}

It appears to be concatenating two lists, which are properly defined - I have no idea whats wrong!

Can anyone help?

Thanks,
Matt

@thebtm
Copy link

thebtm commented Nov 29, 2022

I also get this same error when deploying to RHEL 8.

@thebtm
Copy link

thebtm commented Nov 29, 2022

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

@sancfc
Copy link

sancfc commented Feb 9, 2023

I have exactly the same error, CentOS 8 and ansible 2.13.3 and you?

@mkoertgen
Copy link

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).

@Al-thi
Copy link

Al-thi commented Oct 11, 2023

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

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

5 participants