我使用以下命令从aws导入清单,它工作得很好:
ansible-inventory -i /etc/ansible/inventory/ec2.py --list -y > $some_dic现在,我想使用特定的aws凭证,所以我修改了命令,如下所示:
/etc/ansible/inventory/ec2.py --list --profile my-profile它工作得很好。
然而,当我把所有这些放在一起时,它就不起作用了
ansible-inventory -i /etc/ansible/inventory/ec2.py --list --profile my-profile -y > $some_dic错误:
ansible-inventory: error: unrecognized arguments: --profile对这个问题有什么想法吗?
发布于 2020-06-10 18:31:18
ansible-inventory命令尝试解析它没有的所有选项,包括--profile。
/etc/ansible/inventory/ec2.py --list --profile my-profile使用--profile选项执行ec2.py,但是当使用-i选项将相同的ec2.py传递给ansible-inventory时,该文件本身将成为ansible-inventory命令的参数。
不过,我还没有尝试过,您可以尝试设置AWS_PROFILE,然后执行类似于described here的命令。
另外,还可以查看文档以了解ansible-inventory的可用选项。
https://stackoverflow.com/questions/62300534
复制相似问题