How to set the docker current working directory via commandline ansible-runner?

Hi everyone,

Apart from running locally the AWX jobs (see the other thread at https://groups.google.com/g/awx-project/c/XhY-uDSxDIo for the motivation), I am also focusing on running ansible-runner locally in commandline mode on our existing repository (with process isolation done via docker).

This playbook repository has a particular structure which does not abide by the ansible-runner input directory hierarchy (https://ansible-runner.readthedocs.io/en/stable/intro/#inputdir). I am thus using the several ansible-runner commandline parameters to point at the various pieces that are required.

I am stumbling upon an issue in that the playbook I specify cannot be found by the newly spawned container:
ERROR! the playbook: deploy-stack.yaml could not be found

Investigating in debug mode, I see this is because the underlying docker commandline always has —workdir /runner/project specified whereas the playbook is actually located/mounted under /runner/deploy-stack.yaml

If I edit the docker commandline and run it manually to specify --workdir /runner, then ansible-playbook starts and find the playbook, as expected.

I have looked into the ansible-runner source (I am using v2.1.1) and it seems the logic which sets the working directory is at https://github.com/ansible/ansible-runner/blob/2.1.1/ansible_runner/config/_base.py#L451

It should be overridable via either self.container_dir or self.host_cwd. The thing is, I can’t find where the commandline entry point (and not the Python one) is actually setting those values.

Could someone explain how the container working directory can be set when being called in commandline mode?

Many thanks for your help!

Vincent

PS: full log attached (sorry for the non-printable characters, this was captured via tee)

With the file this time.

(attachments)

ansible-runner-log.txt (17.8 KB)

Hi everyone,

After discussing things w/ Alan on a separate ansible-runner ticket, I have opened https://github.com/ansible/ansible-runner/issues/945 to track my issue.

Vincent