简体   繁体   中英

Ansible ec2_facts outputs null

I am currently working on using Ansible for implementing rolling upgrade feature.

I was trying to gather ec2_facts using dynamic inventory however it outputs null and is not able to gather any information

command used:

 ansible localhost  -i ec2.py -m ec2_facts 

OUTPUT

localhost | success >> {
"ansible_facts": {
    "ansible_ec2_public-key": null,
    "ansible_ec2_public_key": null,
    "ansible_ec2_user-data": null,
    "ansible_ec2_user_data": null
},
"changed": false
}

If I am trying it using

 ansible all  -i ec2.py -m ec2_facts 

I recieve the following OUTPUT

No hosts matched

Can anyone point out what I am missing here ? Thanks

I have access keys set up correctly and I am able to get host information if I am doing

./ec2.py --list

我可以通过正确导出AWS凭证来解决此问题,如此处所述Ansible AWS Guide

I ran into this issue as well, but my issue was caused by proxies. So, my fix was to null out the proxy environment variables just for the ec2_facts.

- name: Gather EC2 facts
  local_action: ec2_facts
  environment:
    http_proxy: ""
    https_proxy: ""

Hope that helps future poor souls stuck with this issue

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM