trouble with ec2 inventory script

Also, what's the proper way to tell ansible to use a given pem file to
access a given ec2 host? As far as I understand reading the docs
~/.ssh/config is no longer used, and I've seen some examples where the info
is both stuck into ssh-agent and a playbook
(https://github.com/coopernurse/ansible-demo). Is there a generally accepted
way of doing this?

Per host pem files are currently not supported, it assumes you use the
same one for all hosts, I would accept patches for an
ansible_ssh_private_key inventory variable that works somewhat like
ansible_ssh_host or ansible_ssh_port. Make sure to modify both the
paramiko and ssh connection types.

(there is also the --private-key option and the config file way to set
that globally)

(In the example you linked I don't see where that's referenced in the
playbook, either)

So yeah, a patch would be welcome.

Actually, this completely separate from SSH.

The AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are used to make API calls to AWS.

What you need to do is go to:

https://portal.aws.amazon.com/gp/aws/securityCredentials

and create an Access Key (if you don’t have one already). Then use those 2 keys with the EC2 inventory script.

You can test the EC2 inventory script is working by executing it. So if you replaced your ansible hosts file with it, you can just execute

/etc/ansible/hosts

and you will see JSON output of all instances you have running.

Peter Sankauskas