I know it’s possible to add –private-key=path/to/key to specify which ssh key you would like Ansible to use. However that assumes that each host requires the same key. Is it possible to specify that setting per host, perhaps in the inventory file or something?
set this as a host or group var:
ansible_ssh_private_key_file
Via inventory you can set ‘ansible_ssh_private_key_file’ per host. See http://docs.ansible.com/intro_inventory.html#list-of-behavioral-inventory-parameters
Thanks!
Apparently I missed that when I was reading that list.
Also is there a way to do the same thing with host_key_checking? I’d like to turn that off but only for a certain set of hosts (eg. dev hosts generated on the fly).
I don’t believe it’s possible to have that per host, via Ansible. But you could set it up in your ssh config. There were a few other threads in this mailing list about this topic. One would be: https://groups.google.com/d/msg/ansible-project/8p3XWlo83ho/Q1SflaZ9dyAJ