Ansible ignore aws_ec2 inventory plugin

14 views
Skip to first unread message

wagaboond

unread,
Mar 17, 2020, 5:24:45 AM3/17/20
to Ansible Project
Hello, i'm trying to get instance information, but my inventory has ignored by ansible\ec2 modules.

/etc/ansible/ansible.cfg
[inventory]
# enable inventory plugins, default: 'host_list', 'script', 'auto', 'yaml', 'ini', 'toml'
#enable_plugins = host_list, virtualbox, yaml, constructed
enable_plugins
= aws_ec2
My inventory:
plugin: aws_ec2
regions
:
 
- ap-northeast-2
filters
:
 
"tag:Name":
   
- "instance1"
   
- "instance2"
Im my config i use default region us-east-1.
my task:
- hosts: localhost
  gather_facts
: False
  tasks
:
 
- name: get instance info
    ec2_instance_info
:
      filters
:
        instance
-state-name: [ "running" ]
       
 
- name: List of instances
    debug
:
      msg
: "{{ instances }}"
And whatever region i use, i'm always get info from my config region us-east, when ansible-inveintory stil give me right information about instances in ec_aws plugin.

I want to use 2-3 inventory one by region. But always get default region info. Please help =)



Reply all
Reply to author
Forward
0 new messages