2

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?

Community
  • 1
  • 1
hgcrpd
  • 1,820
  • 3
  • 19
  • 32

1 Answers1

2

You can set env.key_filename to 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:

.. but is there a way that makes use of the roledefs feature?

No.

Jasper van den Bosch
  • 3,169
  • 4
  • 32
  • 55