[英]Using Ansible with AWS dynamic inventory (ec2.py)
嘗試使用 ec2.py 使用靜態+動態主機文件。
我試過以下指南:
重要的是要說在下面運行它是有效的!
ansible -m ping tag_Ansible_Test
意思是 aws-cli、boto 和 ec2.py 已正確安裝並正常工作。
現在,在 hosts 文件中定義以下組(如文檔所述)時:
[tag_Ansible_Test]
[backend-test-group:children]
tag_Ansible_Test
ansible -m ping backend-test-group -vvvv
嘗試對組運行 ansible 命令時,出現以下錯誤:
ansible 2.4.0.0 config file = /etc/ansible/ansible.cfg configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python2.7/site-packages/ansible executable location = /bin/ansible python version = 2.7.5 (default, Nov 20 2015, 02:00:19) [GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] Using /etc/ansible/ansible.cfg as config file setting up inventory plugins Parsed /etc/ansible/ec2.py inventory source with script plugin [WARNING]: Could not match supplied host pattern, ignoring: backend-test-group [WARNING]: No hosts matched, nothing to do Loading callback plugin minimal of type stdout, v2.0 from /usr/lib/python2.7/site-packages/ansible/plugins/callback/__init__.pyc
我在這里缺少什么?
通過如下設置文件夾結構解決的問題:
/etc/ansible/combined
- hosts (the original file static+dynamic hosts file)
- ec2.py
- ec2.ini
然后,更改 ansible.cfg 中的inventory
設置:
...
inventory = /etc/ansible/combined
...
感謝@KonstantinSuvorov 幫助解決這個問題!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.