在Ansible的Gathering Facts中出现了认证或权限失败
执行命令
$ ansible-playbook make_my_env.yml -K
错误信息
TASK [Gathering Facts] **********************************************************************************************************************************************************************************************************************
fatal: [localhost]: UNREACHABLE! => {"changed": false, "msg": "Authentication or permission failure. 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\". Failed command was: ( umask 77 && mkdir -p \"` echo /home/miyagaw61/.ansible/tmp/ansible-tmp-1529461607.904595-153673846566447 `\" && echo ansible-tmp-1529461607.904595-153673846566447=\"` echo /home/miyagaw61/.ansible/tmp/ansible-tmp-1529461607.904595-153673846566447 `\" ), exited with result 1", "unreachable": true}
to retry, use: --limit @/mnt/c/Users/miyagaw61/home/src/github.com/miyagaw61/chikuwansible/make_my_env.retry
看着的地方 zhe de
Failed command was:
(
umask 77 && mkdir -p \"` echo /home/miyagaw61/.ansible/tmp/ansible-tmp-1529461607.904595-153673846566447 `\" && echo ansible-tmp-1529461607.904595-153673846566447=\"` echo /home/miyagaw61/.ansible/tmp/ansible-tmp-1529461607.904595-153673846566447 `\"
)
解决方案
尝试剪下命令部分
umask 77 && mkdir -p \"` echo /home/miyagaw61/.ansible/tmp/ansible-tmp-1529461607.904595-153673846566447 `\" && echo ansible-tmp-1529461607.904595-153673846566447=\"` echo /home/miyagaw61/.ansible/tmp/ansible-tmp-1529461607.904595-153673846566447 `\"
除了逃逸之外
umask 77 && mkdir -p "` echo /home/miyagaw61/.ansible/tmp/ansible-tmp-1529461607.904595-153673846566447 `" && echo ansible-tmp-1529461607.904595-153673846566447="` echo /home/miyagaw61/.ansible/tmp/ansible-tmp-1529461607.904595-153673846566447 `"
执行
$ umask 77 && mkdir -p "` echo /home/miyagaw61/.ansible/tmp/ansible-tmp-1529461607.904595-153673846566447 `" && echo ansible-tmp-1529461607.904595-153673846566447="` echo /home/miyagaw61/.ansible/tmp/ansible-tmp-1529461607.904595-153673846566447 `"
mkdir: cannot create directory ‘/home/miyagaw61/.ansible/tmp’: Permission denied
删除
$ sudo rm -rf ~/.ansible/tmp
再执行
$ umask 77 && mkdir -p "` echo /home/miyagaw61/.ansible/tmp/ansible-tmp-1529461607.904595-153673846566447 `" && echo ansible-tmp-1529461607.904595-153673846566447="` echo /home/miyagaw61/.ansible/tmp/ansible-tmp-1529461607.904595-153673846566447 `"
ansible-tmp-1529461607.904595-153673846566447=/home/miyagaw61/.ansible/tmp/ansible-tmp-1529461607.904595-153673846566447