ansible-runner
ansible-runner copied to clipboard
Cannot specify inventory when using ansible-runner with podman container (process-isolation) and --limit
Specifying the inventory when combining the options of --process-isolation and --limit will ALWAYS use the inventory file <private_data_dir>/inventory/hosts.
ansible-runner run --playbook test.yml --limit host1 [--inventory <FQPATH>] .
works no matter where the inventory file is specified (in ansible.cfg or using --inventory on the CLI)
ansible-runner run --playbook test.yml --process-isolation --limit host1 [--inventory <FQPATH> | --inventory <RELPATH> ] .
fails no matter where the inventory file is specified (in ansible.cfg or using --inventory on the CLI)
It always shows:
inventory: ('/runner/inventory/hosts',)
ERROR! Specified hosts and/or --limit does not match any hosts
While there might be a way to work around that with an INI version of a static inventory file, if you instead put a dynamic inventory config at <private_data_dir>/inventory/hosts.yml it will not work.
@alice-rc Thanks for reporting this issue. We will try to reproduce this on our end.
I experience the same issue. ansible-runner seems to ignore any value given for inventory on the cli using the settings (env/settings) below. Whatever value is given, it sticks to '/runner/inventory/hosts'.
---
container_image: quay.io/ansible/creator-ee
containerized: true
process_isolation_executable: docker
process_isolation: true
The version inside the container:
bash-4.4# ansible-runner --version
2.1.4.dev2
Command line from debug:
command: docker run --rm --tty --interactive --workdir /runner/project -v /home/djvl/git/p/ansible/ansible_runner_linux_base/:/runner/:Z --env-file /home/djvl/git/p/ansible/ansible_runner_linux_base/artifacts/a0dd652d-106c-4402-a07e-b8e53ef9b3f5/env.list --user=1000 --name ansible_runner_a0dd652d-106c-4402-a07e-b8e53ef9b3f5 quay.io/ansible/creator-ee ansible-playbook -i /runner/inventory/hosts -e @/runner/env/extravars ping.yml
This might be the reason - https://github.com/ansible/ansible-runner/blob/d467662f585f5bb6ed2c5e8d57f130772760031a/ansible_runner/config/runner.py#L163
Any update on when this might get worked on?
I also encountered same issue, any update on this?
Hello @alice-rc. Could you please try again with our latest release of ansible-runner
version 2.4
? It contains several fixes for inventory related issues. Specifically, I suspect you may have been affected by a bug fixed with PR #1304.