更新
不记得我是如何修复它的,但它似乎仅仅是因为ec2.py脚本上的许可是错误的。
我有一些带有动态库存设置的Ansible手册要部署在AWS EC2上。
当在服务器内部使用ansible-playbook时,它可以正常工作。
ansible-playbook setup.yml它位于Ubuntu 14.04和Ansible 2.0.1.0上,默认为/etc/ansible/ansible.cfg。
[defaults]
remote_user = ubuntu
hostfile = /etc/ansible/ec2.py
host_key_checking = False我拿到了ec2.py和ec2.ini inventory.html
在Jenkins上使用此插件https://wiki.jenkins-ci.org/display/JENKINS/Ansible+Plugin触发播放本时
它返回关于ec2.py的错误,因为它认为主机文件是ini文件。
ERROR! The file /etc/ansible/hosts is marked as executable, but failed to execute correctly. If this is not supposed to be an executable script, correct this with `chmod -x /etc/ansible/hosts`.
Inventory script (/etc/ansible/hosts) had an execution error: Traceback (most recent call last):
File "/etc/ansible/hosts", line 1328, in <module>
Ec2Inventory()
File "/etc/ansible/hosts", line 177, in __init__
self.do_api_calls_update_cache()
File "/etc/ansible/hosts", line 424, in do_api_calls_update_cache
self.get_instances_by_region(region)
File "/etc/ansible/hosts", line 469, in get_instances_by_region
conn = self.connect(region)
File "/etc/ansible/hosts", line 440, in connect
conn = self.connect_to_aws(ec2, region)
File "/etc/ansible/hosts", line 458, in connect_to_aws
conn = module.connect_to_region(region, **connect_args)
File "/usr/local/lib/python2.7/dist-packages/boto/ec2/__init__.py", line 66, in connect_to_region
return region.connect(**kw_params)
File "/usr/local/lib/python2.7/dist-packages/boto/regioninfo.py", line 187, in connect
return self.connection_cls(region=self, **kw_params)
File "/usr/local/lib/python2.7/dist-packages/boto/ec2/connection.py", line 103, in __init__
profile_name=profile_name)
File "/usr/local/lib/python2.7/dist-packages/boto/connection.py", line 1100, in __init__
provider=provider)
File "/usr/local/lib/python2.7/dist-packages/boto/connection.py", line 569, in __init__
host, config, self.provider, self._required_auth_capability())
File "/usr/local/lib/python2.7/dist-packages/boto/auth.py", line 989, in get_auth_handler
'Check your credentials' % (len(names), str(names)))
boto.exception.NoAuthHandlerFound: No handler was ready to authenticate. 1 handlers were checked. ['HmacAuthV4Handler'] Check your credentials
/etc/ansible/hosts:3: Error parsing host definition ''''': No closing quotation 如果我在Dynamic inventory中使用选项Dynamic inventory,那么它将使用一个随机的.ini文件,如下所示
/usr/local/bin/ansible-playbook /data/ansible-playbooks/setup.yml -i /tmp/inventory487543089183487870.ini -f 5
[WARNING]: provided hosts list is empty, only localhost is available以前有人遇到过这个问题吗?
发布于 2016-03-10 16:02:21
不知何故,库存无法装载ENV。上述错误意味着无法加载凭据。我用IAM证书更新~/.aws/credentials,然后游戏手册现在就能正常工作了。
https://stackoverflow.com/questions/35920564
复制相似问题