controller_configuration
controller_configuration copied to clipboard
filetree_create fails interacting with Ansible Tower
Summary
filetree_export does not behave properly when targeting an Ansible Tower machine
Issue Type
- Bug Report
Ansible, Collection, Controller details
Ansible Tower Version Tower 3.8.6
Jump host running the playbook
$ ansible --version
ansible [core 2.15.9]
$ ansible-galaxy collection list
# /home/admin/.ansible/collections/ansible_collections
Collection Version
------------------------------ -------
ansible.controller 4.5.2
ansible.posix 1.5.4
awx.awx 23.9.0
community.docker 3.4.9
containers.podman 1.11.0
infra.aap_utilities 2.3.0
infra.ah_configuration 2.0.4
infra.controller_configuration 2.6.0
infra.ee_utilities 3.1.2
kubernetes.core 2.4.0
OS / ENVIRONMENT
Jump Host - RHEL 9.3 Tower Host - RHEL 7.9
Desired Behavior
Playbook should generate a filetree with configuration as code
Actual Behavior
]$ ansible-playbook -i tower-inventory playbooks/filetree_create.yml --vault-password-file=../vault -vv
ansible-playbook [core 2.15.9]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/admin/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.9/site-packages/ansible
ansible collection location = /home/admin/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible-playbook
python version = 3.9.18 (main, Jan 4 2024, 00:00:00) [GCC 11.4.1 20230605 (Red Hat 11.4.1-2)] (/usr/bin/python3)
jinja version = 3.1.3
libyaml = True
Using /etc/ansible/ansible.cfg as config file
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.
PLAYBOOK: filetree_create.yml ***********************************************************************************************************************************************************************************************************************************************************************************************
1 plays in playbooks/filetree_create.yml
PLAY [Playbook to create a filetree] ****************************************************************************************************************************************************************************************************************************************************************************************
TASK [Gathering Facts] ******************************************************************************************************************************************************************************************************************************************************************************************************
task path: /home/admin/aap-casc/playbooks/filetree_create.yml:2
ok: [tower.bontreger.dev]
TASK [Create filetree] ******************************************************************************************************************************************************************************************************************************************************************************************************
task path: /home/admin/aap-casc/playbooks/filetree_create.yml:15
TASK [infra.controller_configuration.filetree_create : Validating arguments against arg spec 'main' - An Ansible Role to create a local file tree of objects existing in Controller] ****************************************************************************************************************************************
task path: /home/admin/aap-casc/playbooks/filetree_create.yml:2
ok: [tower.bontreger.dev] => {"changed": false, "msg": "The arg spec validation passed", "validate_args_context": {"argument_spec_name": "main", "name": "filetree_create", "path": "/home/admin/.ansible/collections/ansible_collections/infra/controller_configuration/roles/filetree_create", "type": "role"}}
TASK [infra.controller_configuration.filetree_create : Check if the collection ansible.controller is installed] *************************************************************************************************************************************************************************************************************
task path: /home/admin/.ansible/collections/ansible_collections/infra/controller_configuration/roles/filetree_create/tasks/main.yml:9
ok: [tower.bontreger.dev] => {"ansible_facts": {"ansible_controller_collection_installed": "ansible.controller 4.5.2"}, "changed": false, "failed_when_result": false}
TASK [infra.controller_configuration.filetree_create : Set the collection providing the controller_api lookup plugin] *******************************************************************************************************************************************************************************************************
task path: /home/admin/.ansible/collections/ansible_collections/infra/controller_configuration/roles/filetree_create/tasks/main.yml:19
ok: [tower.bontreger.dev] => {"ansible_facts": {"controller_api_plugin": "ansible.controller.controller_api"}, "changed": false}
TASK [infra.controller_configuration.filetree_create : Fail if no collection is detected] ***********************************************************************************************************************************************************************************************************************************
task path: /home/admin/.ansible/collections/ansible_collections/infra/controller_configuration/roles/filetree_create/tasks/main.yml:22
skipping: [tower.bontreger.dev] => {"changed": false, "false_condition": "controller_api_plugin is match('NONE')", "skip_reason": "Conditional result was False"}
TASK [infra.controller_configuration.filetree_create : Show the plugin we are using] ****************************************************************************************************************************************************************************************************************************************
task path: /home/admin/.ansible/collections/ansible_collections/infra/controller_configuration/roles/filetree_create/tasks/main.yml:26
ok: [tower.bontreger.dev] => {
"msg": "Using the 'controller_api' plugin from: ansible.controller.controller_api"
}
TASK [infra.controller_configuration.filetree_create : Check if the required input variables are present] *******************************************************************************************************************************************************************************************************************
task path: /home/admin/.ansible/collections/ansible_collections/infra/controller_configuration/roles/filetree_create/tasks/main.yml:30
ok: [tower.bontreger.dev] => {"changed": false, "msg": "All assertions passed"}
TASK [infra.controller_configuration.filetree_create : Check if the required input values are correct] **********************************************************************************************************************************************************************************************************************
task path: /home/admin/.ansible/collections/ansible_collections/infra/controller_configuration/roles/filetree_create/tasks/main.yml:38
ok: [tower.bontreger.dev] => (item=all) => {"ansible_loop_var": "tag_item", "changed": false, "msg": "All assertions passed", "tag_item": "all"}
TASK [infra.controller_configuration.filetree_create : Include Tasks to get all objects of type ['all']] ********************************************************************************************************************************************************************************************************************
task path: /home/admin/.ansible/collections/ansible_collections/infra/controller_configuration/roles/filetree_create/tasks/main.yml:48
included: /home/admin/.ansible/collections/ansible_collections/infra/controller_configuration/roles/filetree_create/tasks/all.yml for tower.bontreger.dev
TASK [infra.controller_configuration.filetree_create : Check if the connection is to an Ansible Tower or to Automation Platform] ********************************************************************************************************************************************************************************************
task path: /home/admin/.ansible/collections/ansible_collections/infra/controller_configuration/roles/filetree_create/tasks/all.yml:2
fatal: [tower.bontreger.dev]: FAILED! => {"msg": "the field 'args' has an invalid value ({'is_aap': \"{{ lookup(controller_api_plugin, 'ping', host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs).version is version('4.0.0', '>=') }}\"}), and could not be converted to an dict.The error was: unmarshallable object\n\nThe error appears to be in '/home/admin/.ansible/collections/ansible_collections/infra/controller_configuration/roles/filetree_create/tasks/all.yml': line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n---\n- name: \"Check if the connection is to an Ansible Tower or to Automation Platform\"\n ^ here\n"}
PLAY RECAP ******************************************************************************************************************************************************************************************************************************************************************************************************************
tower.bontreger.dev : ok=8 changed=0 unreachable=0 failed=1 skipped=1 rescued=0 ignored=0
STEPS TO REPRODUCE
---
- name: Playbook to create a filetree
hosts: all
vars_files:
- "../vault.yml"
connection: local
vars:
output_path: /home/admin/filetree/
valid_tags: ['all']
controller_hostname: "https://tower.bontreger.dev"
controller_username: "admin"
controller_password: "<<redacted>>"
flatten_output: true
tasks:
- name: Create filetree
ansible.builtin.include_role:
name: infra.controller_configuration.filetree_create
$ cat tower-inventory
[tower]
tower.bontreger.dev
Was able to downgrade ansible to 2.15.5 and get around the issue at play. Have an additional update to make as the filetree_create needs to skip over constructed inventories on non-aap installs
I suspect this is related to #741
This issue comes from this change from ansible 2.15.7: https://github.com/ansible/ansible/issues/82708.
It seems it is solved for 2.16 https://github.com/ansible/ansible/pull/82759/files
The fix was backported to 2.14 and 2.15. I think we can close this issue because it is a bug in Ansible Core. It was solved and it will be working property again in next releases. Meanwhile, I suggest to use ansible 2.15.6 while it is possible.
https://github.com/ansible/ansible/pull/82791 https://github.com/ansible/ansible/pull/82790
Closing as seems to be fixed and no recent updates. Reopen if needed.