I recently inherited an Ansible deployment that manages some EC2 instances and I have a couple questions. I am unable to find a pem file/ssh key on the local file system, but somehow Ansible is able to connect to the instances it creates and run shell scripts. How is this possible? I’m not trying to enhance the existing playbooks to update some data via a script on a central/master server in our deployment every time we create a new instance, but I’m having trouble connecting to the instance. How can I use whatever mechanism is in place for the recently provisioned instances to access this single (relatively static) instance?
{ role: common, XXXextra instance variablesXXX } <— this role (in main.yml) calls a number of scripts and shell commands on the instance. How can it connect? and how can I replicate that connection?
run ansible with -vvvvv and you should see the full ssh command used,
that should point at a key, if not you likely have an agent or the ssh
user/password info in inventory.
I would grep -r your ansible directory for mykeypair. Since it is a variable specified in your playbook, either you need to define that on the command line with extra-vars, or the name of the keypair is written as a variable in a file somewhere (vars file, hosts file,etc).
Joanna - thanks; I don’t see any references to that variable in /etc/ansible, and the only places I see it in my playbook directory are references to the amazon key name, no files.
I think the problem may be orthogonal to what I was thinking of yesterday, though. I tried running my existing Ansible script with the debug output, as suggested earlier - this also failed with an SSH key problem. On further investigation, I realized that Ansible Tower provides a credentials repository, so, It might ‘just work’ through the Tower interface. I was hoping to debug my script through the terminal, but since everything else we do runs through Tower, I’ll try testing through there.
ah, that is totally different question, tower keeps it's credentials
in it's own store. Also for tower questions go to support.ansible.com
support@ansible.com