Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to specify the remote user and private key file to be used when using terraform-inventory #106

Open
queglay opened this issue Feb 23, 2019 · 0 comments

Comments

@queglay
Copy link

queglay commented Feb 23, 2019

Something I can't figure out though is how to define the remote user and path to the private key when using the inventory generated by this tool to connect with ec2 instances. Normally you could do something like this in the inventory from what I've been reading:

[openvpn]
52.54.106.87 ansible_ssh_user=openvpnas ansible_ssh_private_key_file=~/aws-private.pem

However with the dynamic inventory this isn't possible, or at least clear to me how to change my implementation.
I have a bunch of instances in the infrastructure template from terraform, so this is just an example.

currently I can run a test playbook like this, but its not ideal

ansible-playbook -i /usr/local/bin/terraform-inventory --private-key ~/my_key_pair.pem -l openvpn ansible/openvpn.yaml

I thought a suitable workaround would be to use ssh-add, but for some reason, I can't get that command to work with my vagrant ubuntu/xenial64 vb image.

vagrant@openfirehawkserver:/vagrant$ ssh-add ~/my_key_pair.pem 
Could not open a connection to your authentication agent.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant