In a current project I have been facing some issues with ansible connecting through a bastion using the right keys.
So I went digging. Turn out by default it’s trying out some default set of keys but it wasn’t using the right key for this host (the key doesn’t have any standard name, which didn’t help)
So after hacking something around using the ssh config file I went for look for a way to fix that stuff.
In ansible.cfg specify
|
|
This allow us to have a config file at the project level, which mean it can be commit to the repo and shipped with the rest of the ansible code.
|
|
Note the import identity.cfg
- this will help us to allow for local identity switch after with git.
|
|
Let’s test - here is a playbook to check the connectivity
|
|