我正在使用 ansijet
自动化 ansible playbook 以在单击按钮时运行。该剧本是停止 AWS 上正在运行的实例。如果从命令行手动运行,剧本运行良好并完成任务。但是当通过ansijet
的web界面运行时,遇到如下错误
Authentication or permission failure. In some cases, you may have been able to authenticate and did not have permissions on the remote directory. Consider changing the remote temp path in ansible.cfg to a path rooted in "/tmp". Failed command was: mkdir -p $HOME/.ansible/tmp/ansible-tmp-1390414200.76-192986604554742 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1390414200.76-192986604554742 && echo $HOME/.ansible/tmp/ansible-tmp-1390414200.76-192986604554742, exited with result 1:
以下是
ansible.cfg
配置。# some basic default values...
inventory = /etc/ansible/hosts
#library = /usr/share/my_modules/
remote_tmp = $HOME/.ansible/tmp/
pattern = *
forks = 5
poll_interval = 15
sudo_user = root
#ask_sudo_pass = True
#ask_pass = True
transport = smart
#remote_port = 22
module_lang = C
我尝试更改
remote_tmp
路径 /home/ubuntu/.ansible/tmp
但仍然得到同样的错误。
最佳答案
默认情况下,用户 Ansible 连接到远程服务器,其名称与运行用户 ansible 的名称相同。在 Ansijet 的情况下,它将尝试使用任何用户启动 Ansijet 的 node.js 进程连接到远程服务器。您可以通过指定 remote_user
来覆盖它。在剧本或全局范围内 ansible.cfg
文件。
如果临时目录不存在,Ansible 将尝试创建临时目录,但如果该用户没有主目录或他们的主目录权限不允许他们写访问,则将无法创建。
我实际上更改了 ansible.cfg
中的临时目录文件指向/tmp 中的一个位置,它可以解决这些问题。remote_tmp = /tmp/.ansible-${USER}/tmp
关于amazon-web-services - 认证或权限失败,对远程目录没有权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35176548/