Closed 0b11stan closed 10 months ago
I'm not very familiar with internals of ansible or molecule but it look like ansible is not putting a sudo
before the podman command despite my best efforts.
In the molecule/default/molecule.yml
file I tried to force the provisioner :
provisioner:
name: ansible
ansible_args: [ '--become' ]
inventory:
host_vars:
localhost:
ansible_become_password: natsirt
ansible_become: true
But the output of molecule -vvv converge
is quite clear, no sudo :
PLAY [Converge] ****************************************************************
TASK [Gathering Facts] *********************************************************
task path: /tmp/test/poc/molecule/default/converge.yml:2
redirecting (type: connection) ansible.builtin.podman to containers.podman.podman
<instance> RUN [b'/usr/bin/podman', b'mount', b'instance']
<instance> RUN [b'/usr/bin/podman', b'exec', b'instance', b'/bin/sh', b'-c', b'echo ~ && sleep 0']
<instance> RUN [b'/usr/bin/podman', b'exec', b'instance', b'/bin/sh', b'-c', b'echo "`pwd`" && sleep 0']
<instance> RUN [b'/usr/bin/podman', b'exec', b'instance', b'/bin/sh', b'-c', b'( umask 77 && mkdir -p "` echo ~/.ansible/tmp `"&& mkdir "` echo ~/.ansible/tmp/ansible-tmp-1631627125.3743653-58864-212520581875777 `" && echo ansible-tmp-1631627125.3743653-58864-212520581875777="` echo ~/.ansible/tmp/ansible-tmp-1631627125.3743653-58864-212520581875777 `" ) && sleep 0']
fatal: [instance]: UNREACHABLE! => {
"changed": false,
"msg": "Failed to create temporary directory.In some cases, you may have been able to authenticate and did not have permissions on the target directory. Consider changing the remote tmp path in ansible.cfg to a path rooted in \"/tmp\", for more error information use -vvv. Failed command was: ( umask 77 && mkdir -p \"` echo ~/.ansible/tmp `\"&& mkdir \"` echo ~/.ansible/tmp/ansible-tmp-1631627125.3743653-58864-212520581875777 `\" && echo ansible-tmp-1631627125.3743653-58864-212520581875777=\"` echo ~/.ansible/tmp/ansible-tmp-1631627125.3743653-58864-212520581875777 `\" ), exited with result 125",
"unreachable": true
}
PLAY RECAP *********************************************************************
instance : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0
The connection should be modified to make ansible play commands with 'sudo podman' but I don't know how to do that.
Hi, I proposed a fix for the
create
step (https://github.com/ansible-community/molecule-podman/pull/83) but theconverge
step is also broken.Versions
How to reproduce
I'm pulling the code from my fork to avoid the issue https://github.com/ansible-community/molecule-podman/issues/77 but i'm up to date with upstream.
What is happening
What is expected