Search code examples
amazon-ec2ansibleansible-inventory

Ansible aws_ec2 inventory plugin issue


I am trying to get started using Ansible and the aws_ec2 plugin.

I have the following in my ./ansible.cfg file:

[inventory]
enable_plugins = aws_ec2

and the following in my ./inventory.yml file:

plugin: aws_ec2
aws_access_key_id: **********
aws_secret_access_key: **********
regions:
    - us-east-2

when I run ansible-inventory -i inventory.yml --graph I get the following error:

inventory.yml did not meet aws_ec2 requirements, check plugin documentation if this is unexpected


Solution

  • As of Ansible 2.7.6:

    aws_ec2 inventory filename must end with 'aws_ec2.yml' or 'aws_ec2.yaml'

    proof.

    So rename your inventory.yml into inventory_aws_ec2.yml and you are good to go.