Hi All,
I’m trying to configure few ec2 instances using ansible, hence I created dynamic inventory in controller and playbook both. but I found that I need to pass private key where I’m little bit confused.
-
Does Private key refer to key which is being used for ansible purpose or ec2 launching keypair?
-
Do I need to mention that private key path inside playbook?
Please help me to get these answers.
Thanks,
Anirban Das
Hard to give a useful answer without any actual code (playbooks, inventory, etc)
HI,
aws_ec2.yml -------->> dynamic inventory
and the exact error would be…?
This is just a regular SSH login issue.
It depends on how your instances are configured. Do you have keys configured in AWS, are you using the userdata to provision them, etc.
I have created aws ec2 instances through Terraform, so that time I have mentioned key name for ec2 launching. But yes didn’t mention ansible private key in terraform script. So in the provisioner bock I put ansible playbook command with private-key path. What else do I need to do??
you can check below terraform script and please guide me.
1. Confirm that the ssh key mentioned in "Keypair-01" is the one in your ssh-agent locally.
2. Confirm that your local user exists on the remote host, and has the ssh-key in the authorized_keys file.
3. Confirm that you can do "ssh -i /path/to/private/key AWS_HOST" and can log in without any problems.
4. See if you can run 'ansible AWS_HOST -m ping' and get a response.
These can provide clues to what is wrong.