Recommend way of handling passwords?

Hey, just started working with Nornir and love it. What is the recommended way of storing and inserting device passwords for Nornir to use? I don’t really want to have my network credentials stored in clear text in a yaml file. Is there a way around this? Perhaps a way to substitute this information in from another config.ini like file that I don’t upload to my VCS?



There are a few ways to can do that.

  • use getpass to manually type in the password on execution
  • load password from an config.ini file that is in our .gitgnore
  • store it as environment variable
  • use ansible vault for storage

to set a new default password:
nr.inventory.defaults.password = password

or on specific hosts:
nr.inventory.hosts[“host-name”].password = password