As discussed in Using an SSH keyfile with Fabric, it is possible to set an ssh keyfile using env.key_filename. How does this setting interact with defining remote hosts in env.roledefs?
If I set key_filename, will Fabric try to use that key with all hosts? What if different hosts require different keys?
A workaround would be to set env.hosts and env.key_filename in a separate task for each set of hosts, but is there a way that makes use of the roledefs feature?
You can set
env.key_filenameto a list of filenames, each of which would then be tried for each connection. Anything more specific you would have to script yourself.From this doc.
So to answer:
No.