Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot specify inventory when using ansible-runner with podman container (process-isolation) and --limit #1114

Open
alice-rc opened this issue Aug 11, 2022 · 6 comments
Labels
bug Something isn't working needs_info

Comments

@alice-rc
Copy link

alice-rc commented Aug 11, 2022

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.

@github-actions github-actions bot added the needs_triage New item that needs to be triaged label Aug 11, 2022
@Akasurde Akasurde added needs_verified Issue needs to be verified bug Something isn't working and removed needs_triage New item that needs to be triaged labels Aug 23, 2022
@Akasurde
Copy link
Member

Akasurde commented Aug 23, 2022

@alice-rc Thanks for reporting this issue. We will try to reproduce this on our end.

@djvl
Copy link

djvl commented Sep 12, 2022

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

@Akasurde
Copy link
Member

This might be the reason -

if self.containerized:

@Akasurde Akasurde added verified This issue has been verified/reproduced by maintainer and removed needs_verified Issue needs to be verified labels Sep 12, 2022
@alice-rc
Copy link
Author

Any update on when this might get worked on?

@hidogphillip
Copy link

I also encountered same issue, any update on this?

@Shrews
Copy link
Contributor

Shrews commented Jun 17, 2024

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.

@Shrews Shrews added needs_info and removed verified This issue has been verified/reproduced by maintainer labels Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs_info
Projects
None yet
Development

No branches or pull requests

5 participants