Ansible cannot make dir /$HOME/.ansible/cp

ε祈祈猫儿з 提交于 2019-12-04 16:52:35

Try sudo chown -R YOUR_USERNAME /home/YOUR_USERNAME/.ansible

Late to answer but might be useful to someone. Check the ownership of ~/.ansible. The ownership of .ansible in the local machine (which runs ansible/ansible controller node) might be causing the problem. Do "chown -R username:groupname .ansible" (username:groupname should be of the user running the playbook) and try to run the playbook again

As an alternative remove this .ansible directory from controller node and rerun the playbook.

udondan

Ansible creates temporary files in ~/.ansible on your local machine and on the remote machine. So that could be theoretically triggered from both sides.

My guess is, it is on the local machine where Ansible runs since how Ansible was started should not have an effect on the target boxes. A quick search showed programs started with start-stop-deamon do not have $HOME (or any env at all) available, but it has an -e option to set them according to your needs.

If -e is unavailable, see this answer, which suggests to additionally exec /usr/bin/env to set environment variables.

I ran into a similar issue using Jenkins. It had a default $HOME env var set to /root/. The solution was to inject the environment variable at runtime.

HOME=/path/to/your/users/home
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!