build icon indicating copy to clipboard operation
build copied to clipboard

Playbook not compatible with Ansible 12

Open targos opened this issue 3 months ago • 2 comments

When I run ansible-playbook ansible/playbooks/jenkins/docker-host.yaml --limit test-ibm-ubuntu2204_docker-x64-1 with Ansible 12, I get this error:

TASK [package-upgrade : include package manager tasks] **************************************************************************************************************************************
[ERROR]: Task failed: Finalization of task args for 'ansible.builtin.include_tasks' failed: Error while resolving value for '_raw_params': The filter plugin 'match_key' failed: startswith first arg must be str or a tuple of str, not _AnsibleLazyTemplateList

Task failed.
Origin: /Users/mzasso/git/nodejs/build/ansible/roles/package-upgrade/tasks/main.yml:7:5

5 #
6
7   - name: include package manager tasks
      ^ column 5

<<< caused by >>>

Finalization of task args for 'ansible.builtin.include_tasks' failed.
Origin: /Users/mzasso/git/nodejs/build/ansible/roles/package-upgrade/tasks/main.yml:9:5

7   - name: include package manager tasks
8 #    when: not os|startswith("zos")
9     include_tasks: "partials/{{ template }}.yml"
      ^ column 5

<<< caused by >>>

Error while resolving value for '_raw_params': The filter plugin 'match_key' failed: startswith first arg must be str or a tuple of str, not _AnsibleLazyTemplateList
Origin: /Users/mzasso/git/nodejs/build/ansible/roles/package-upgrade/tasks/main.yml:9:20

7   - name: include package manager tasks
8 #    when: not os|startswith("zos")
9     include_tasks: "partials/{{ template }}.yml"
                     ^ column 20

fatal: [test-ibm-ubuntu2204_docker-x64-1]: FAILED! => {"changed": false, "msg": "Task failed: Finalization of task args for 'ansible.builtin.include_tasks' failed: Error while resolving value for '_raw_params': The filter plugin 'match_key' failed: startswith first arg must be str or a tuple of str, not _AnsibleLazyTemplateList"}

targos avatar Sep 25 '25 09:09 targos

https://github.com/ansible-community/ansible-build-data/blob/12.0.0/12/CHANGELOG-v12.md#ansible-core-1

Maybe this is caused by:

variables - The type system underlying Ansible's variable storage has been significantly overhauled and formalized. Attempts to store unsupported Python object types in variables now more consistently yields early warnings or errors. variables - To support new Ansible features, many variable objects are now represented by subclasses of their respective native Python types. In most cases, they behave indistinguishably from their original types, but some Python libraries do not handle builtin object subclasses properly. Custom plugins that interact with such libraries may require changes to convert and pass the native types.

targos avatar Sep 25 '25 10:09 targos

😞

Error while resolving value for '_raw_params': The filter plugin 'match_key' failed: startswith first arg must be str or a tuple of str, not _AnsibleLazyTemplateList
Origin: /Users/mzasso/git/nodejs/build/ansible/roles/package-upgrade/tasks/main.yml:9:20

match_key is from our filters.py plugin: https://github.com/nodejs/build/blob/5a1da0133a411822907952d2e0c9f9b06ce305ff/ansible/plugins/filter/filters.py#L30-L44

FWIW I found I had to pin Ansible (in a Python venv so I can switch between it and later Ansible) to a backlevel version to be able to run against the RHEL 8 servers: https://github.com/nodejs/build/blob/5a1da0133a411822907952d2e0c9f9b06ce305ff/ansible/README.md?plain=1#L10-L13

richardlau avatar Sep 25 '25 11:09 richardlau