ansible-runner
ansible-runner copied to clipboard
--container-image options does not result in playbook being executed in said container
I'm trying to run an ansible playbook in an ansible execution environment with ansible-runner. However, the --container-image
option seems to have no effect. Specifically, when I run this command:
ansible-runner run . -p 00_ubuntu_hardening.yml --container-image <custom ee> -i live
I get the following error:
fatal: [<host>]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: Can't open user config file /etc/ssh/ssh_config.d/config: No such file or directory", "unreachable": true}
If I now create an empty file at /etc/ssh/ssh_config.d/config
on localhost, that error message changes to
fatal: [<host>]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: ssh: Could not resolve hostname <host>: Name or service not known", "unreachable": true}
I think ansible-runner is trying to resolve the path against my local machine. My expectation was however that it would be resolved inside the container (where this file with the correct content ist present). This also works with ansible-navigator.
Is this a bug or am I misunderstanding the --container-image
option?
You are missing required arguments. The --container-image
option alone is not enough to cause runner to use containers for process isolation. See:
https://ansible.readthedocs.io/projects/runner/en/stable/standalone/#running-with-process-isolation
Or, if you want to set these options in the env/settings
file:
https://ansible.readthedocs.io/projects/runner/en/stable/intro/#process-isolation-settings-for-runner
At a minimum, you also need to provide --process-isolation
, which causes podman
to be used as the container system. That can be changed to docker
with the --process-isolation-executable
option.
Closing per above.