【发布时间】:2020-04-04 03:49:06
【问题描述】:
我正在尝试通过 Windows 中的 ubuntu 终端在 EC2 实例上运行我的 ansible playbook
我可以使用以下 ssh 示例登录到 EC2 实例
ssh -i /path/to/my/pemfile.pem ubuntu@ipadress-of-my-EC2
使用该命令我成功登录到我的 EC2 实例。
现在我想使用以下清单文件运行 Ansible
[ec2_test]
hostnameofec2 ansible_host='ipadress-of-ec2' ansible_ssh_user='ubuntu' ansible_ssh_private_key_file='/path/to/my/pemfile.pem'
当我在命令行中运行它时
ansible-playbook /path/to/my/inventory test.yml -vvvv
我在控制台中得到以下输出:
ansible-playbook 2.9.2
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/home/mladen/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /home/mladen/.local/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible-playbook
python version = 2.7.15+ (default, Oct 7 2019, 17:39:04) [GCC 7.4.0]
Using /etc/ansible/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
script declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Parsed /etc/ansible/hosts inventory source with ini plugin
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
ERROR! Syntax Error while loading YAML.
did not find expected <document start>
The error appears to be in '/mnt/d/GGstudio/Ansible/inventory/ggstudio/inventory': line 2, column 1, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
[ec2_test]
hostnameofec2 ansible_host='ipadress-of-ec2' ansible_ssh_user='ubuntu' ansible_ssh_private_key_file='/path/to/my/pemfile.pem'
^ here
所以我不明白当我在清单文件中分配主机时提供的主机列表是空的?
提前谢谢你。
【问题讨论】:
标签: python ubuntu amazon-ec2 ansible