脚本执行时发生ansible抛出错误
我正在尝试使用ansible运行我的主目录(/home/ubuntu)下的脚本(foo) 如果我手动移动到/home/ubuntu并运行下面的脚本脚本执行时发生ansible抛出错误,ansible,Ansible,我正在尝试使用ansible运行我的主目录(/home/ubuntu)下的脚本(foo) 如果我手动移动到/home/ubuntu并运行下面的脚本 ./foo --arg1=aaa --arg2=xxx --arg3=yyy 脚本在命令行中运行良好 但是,当我尝试使用ansible运行相同的脚本时,如下所示 - name: Running Config Script command: chdir=/home/ubuntu ./foo --arg1=aaa --arg2=xxx --arg3
./foo --arg1=aaa --arg2=xxx --arg3=yyy
脚本在命令行中运行良好
但是,当我尝试使用ansible运行相同的脚本时,如下所示
- name: Running Config Script
command: chdir=/home/ubuntu ./foo --arg1=aaa --arg2=xxx --arg3=yyy
脚本失败了。我还尝试使用script标记代替command。它不起作用 我没有测试,但请尝试使用
shell
而不是命令
- name: Running Config Script
shell: ./foo --arg1=aaa --arg2=xxx --arg3=yyy
args:
chdir: /home/ubuntu
您得到的错误到底是什么?您可以使用
-vvv
标志调用ansible playbook进行调试/home/ubuntu/foo
是在本地主机上还是在您试图配置的服务器上?