我试图通过Ansible使用脚本来安装pacaur:Ansible shell命令`pod2man`没有找到
curl -s https://gist.githubusercontent.com/Tadly/0e65d30f279a34c33e9b/raw/pacaur_install.sh | bash
随着ansible命令
ansible 192.168.1.2 -m shell -a "curl -s https://gist.githubusercontent.com/Tadly/0e65d30f279a34c33e9b/raw/pacaur_install.sh | bash"
,但我得到pacman
抱怨pod2man
失踪。这似乎是一个有道理的道路的问题。
直接使用ssh在机器上运行命令可以正常工作。
下面是输出:ansible -m all shell -a 'echo $PATH'
localhost | SUCCESS | rc=0 >>
/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
192.168.1.2| SUCCESS | rc=0 >>
/usr/bin:/bin:/usr/sbin:/sbin
这是否需要以特别的方式完成(在这种情况下,解决这个问题的最快方式就是手动进行ssh和安装),或者在编写剧本时还可以吗?您是否尝试过使用['command'](https://docs.ansible.com/ansible/command_module.html)或['shell'](https://docs.ansible.com/ansible/shell_module.html#shell )而不是?如何运行一个脚本,首先回显'PATH'? –
更可能sudo的PATH。 pacaur_install.sh通过sudo调用pacman。看来,pod2man不在sudo的PATH中。您需要调整安装脚本以在sudo调用中设置PATH或调整sudoers中的PATH。 – sborsky
@XiongChiamiov我需要理智的原因是,实际上我需要在几台机器上安装:)。然而,我发布了脚本的结果,回应了'PATH' @ sborsky这似乎是原因。 [this](http://serverfault.com/questions/734560/ansible-become-user-not-picking-up-path-correctly)问题似乎有关。即使正常的SSH我得到正确的'路径'。 – SolidSnake