[英]ansible dynamic inventory errors out
I'm trying to use dynamic inventory to run ansible play books. 我正在尝试使用动态广告资源来运行有趣的剧本。 if i run ec2.py --list it works fine but when i export varaibles and run ping fails with below error 如果我运行ec2.py --list可以正常工作,但是当我导出变量并运行ping时失败,并出现以下错误
export ANSIBLE_INVENTORY=$PATH/ec2.py export EC2_INI_PATH=$PATH/ec2.ini export PYTHONPATH=/venv/lib/python2.7/site-packages cd $WORKSPACE/ansible inventory list works. without any issues. python $path/ec2.py --list but when i tried to ping dynamic inventory it fails. ec2.py with script plugin: problem running $PATH/ec2.py --list ([Errno 13]
Permission denied) ansible -m ping tag_name_instancename 权限被拒绝)ansible -m ping tag_name_instancename
As specified by the fine manual : 根据精美手册的规定 :
... use Ansible's -i command line option and specify the path to the script after marking it executable ...使用Ansible的-i命令行选项并在将脚本标记为可执行后指定脚本的路径
It ran for you because you called python
with the script as an arg. 它为您运行是因为您以脚本作为arg调用了python
。 It should also work if you ./ec2.py --list
, since that's what ansible is going to do, too 如果您使用./ec2.py --list
,它也应该工作,因为这也是./ec2.py --list
要做的
Run the script like, 像这样运行脚本
$ ./ec2.py --list $ ./ec2.py-列表
For proper setup of dynamic inventory, I will suggest you taking reference from this link. 为了正确设置动态广告资源,我建议您从此链接获取参考。 dynamic-inventory 动态库存
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.