Right now I’m manually editing this file to change the 2 hostnames when I want to work with a different host!
The IdentityFile is the same for all hosts.
Can you suggest a better way? I’ve had trouble finding docs on this.
Funny this came up, as I just finished a playbook that bounces keys several times. There are 2 variables you can use in the playbook itself and can be changed using set_fact:ansible_private_key_file, and ansible_ssh_private_key_file. Used with the ansible_user or ansible_ssh_user variables it can be quite handy cycling users or updating authorized keys mid play.
method, but it’s good to know that this can also be done inside the playbook, as I might want to consider using ansible for key rotation at some point in the future…