对远程目录没有权限

对远程目录没有权限

本文介绍了认证或权限失败,对远程目录没有权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 ansijet 来自动化 ansible playbook,以便在单击按钮时运行.该剧本是停止 AWS 上正在运行的实例.如果从命令行手动运行,剧本运行良好并完成任务.但是通过ansijet的web界面运行,遇到如下错误

I am using ansijet to automate the ansible playbook to be run on a button click. The playbook is to stop the running instances on AWS. If run, manually from command-line, the playbook runs well and do the tasks. But when run through the web interface of ansijet, following error is encountered

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但是还是出现同样的错误.

I try to change the remote_tmp path to /home/ubuntu/.ansible/tmpBut still getting the same error.

推荐答案

默认情况下,用户 Ansible 连接到远程服务器,其名称与运行用户 ansible 的名称相同.在 Ansijet 的情况下,它将尝试使用任何用户启动 Ansijet 的 node.js 进程连接到远程服务器.您可以通过在 playbook 中或在 ansible.cfg 文件中全局指定 remote_user 来覆盖它.

By default, the user Ansible connects to remote servers as will be the same name as the user ansible runs as. In the case of Ansijet, it will try to connect to remote servers with whatever user started Ansijet's node.js process. You can override this by specifying the remote_user in a playbook or globally in the ansible.cfg file.

如果临时目录不存在,Ansible 将尝试创建临时目录,但如果该用户没有主目录或他们的主目录权限不允许他们写访问,则将无法创建.

Ansible will try to create the temp directory if it doesn't already exist, but will be unable to if that user does not have a home directory or if their home directory permissions do not allow them write access.

我实际上将 ansible.cfg 文件中的临时目录更改为指向/tmp 中的一个位置,该位置可解决此类问题.

I actually changed the temp directory in my ansible.cfg file to point to a location in /tmp which works around these sorts of issues.

remote_tmp =/tmp/.ansible-${USER}/tmp

这篇关于认证或权限失败,对远程目录没有权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 19:09