0

アップデート

どのように修正したか覚えていませんが、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.pyhttp://docs.ansible.com/ansible/intro_dynamic_inventory.htmlを取得しましたec2.ini

Jenkinsこのプラグインを使用してプレイブックをトリガーする場合https://wiki.jenkins-ci.org/display/JENKINS/Ansible+Plugin

ec2.pyhostfile が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 

オプションを使用するInline contentと、このような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

誰かが以前にこの問題を抱えていましたか?

4

1 に答える 1