ansible-runner
ansible-runner copied to clipboard
ansible-runner should not set `--workdir` for ad hoc commands
If using process_isolation=True
, then the default behavior is to set --workdir
, and the default location winds up being /runner/project
.
https://github.com/ansible/ansible-runner/blob/dcdb62daf668a31754fc6fbf73374e7d14d5f52c/ansible_runner/config/_base.py#L432
Consider running with module="setup"
as opposed to playbook - running an ad-hoc command. There should be no project directory, because it is not used for anything.
However, if the user does not create a project directory, podman
fails with
Error: chdir: No such file or directory: OCI not found
type of errors. This is because ansible-runner, on its own, adds on --workdir /runner/project
without checking that the "project" directory exists on the host machine, and ignorant of ad hoc commands. The directory doesn't exist, so podman tries to do a chdir
to a directory that doesn't exist, so it errors.
This error is surfaced in the standard out, but that can still be challenging to debug.
Hi @AlanCoding ,
I am hitting a related issue in that I cannot override the directory which is set via --workdir
. I have posted at https://groups.google.com/g/awx-project/c/Il-q0mfkoeA and would welcome your feedback on this. Hopefully this is just something that I have overlooked.
Thanks for your help!
Like you say, it looks like the input to override this is container_workdir
. This is in the interface.py
module, but that's it, no CLI option.
Thank you @AlanCoding. Would it be appropriate to open a separate defect here?
I don't want to pollute yours; both are related but mine is not about ad-hoc commands...
Yeah, that makes sense to track it separately.
Yeah, that makes sense to track it separately.
Thank you, I have opened a separate ticket and referenced my issue there (:point_up: )