pip3 fails when using with become
Summary
After installing python 3 and pip with this role and using ansible pip module with become: yes
, playbook fails with following error:
fatal: [m1]: FAILED! => {"changed": false, "msg": "Unable to find any of pip3 to use. pip needs to be installed."}
Possible fixes
It looks like when executing commands with sudo
, PATH
environment is different and the pip3
package is not there:
[root@9a68888d46a5 repository]# sudo which pip3
which: no pip3 in (/sbin:/bin:/usr/sbin:/usr/bin)
[root@9a68888d46a5 repository]# which pip3
/usr/local/bin/pip3