We have to run an Ansible playbook of a third party vendor within an AAP execution environment.
This playbook needs a custom inventory, which we cannot register as an AAP inventory. So we run “ansible-playbook --inventory /custom/inventory /path/to/3rdparty.yml” either using ansible.builtin.shell or ansible.builtin.command from a wrapper playbook.
The execution itself works fine and gives us the expected result. The biggest problem we have so far is output capturing and output formatting of the ansible-playbook command: We cannot manage to get rid of the escape sequences which are used by ansible-playbook for coloring the output. This makes the Job output unreadable in AAP.
What I tried so far:
- put a custom ansible.cfg into the project and set nocolor=True
- Debug output shows, that the ansible.cfg file is used, but the nocolor setting is not honoured → ansible-playbook still produces colorized output
- trying it out in an interactive session of the EE container, it works fine
- add ANSIBLE_NOCOLOR and NO_COLOR environment vars to the ansible.builtin.shell parameters.
- these do not seem to be honoured either → still colorized output
- all kind of weird stuff you can find on other forums
- pipe the output of ansible-playbook through cat etc. → still colorized output
- put the ansible-playbook call into an extra shell script, setting the environment vars there and run this shell script via ansible.builtin.shell
- no change to the situation
Is there any other way I can run a custom playbook from a wrapper playbook on AAP without the color escape sequences added to the output?
AAP version as far as I can see is 4.4.4
Ansible version in the EE is 2.15.11
Thanks for any hint.
Cheers,
Chris