salt.roster.sshknownhosts

Parses roster entries out of Host directives from SSH known_hosts

Sample configuration:

Note

The known_hosts file only contains hostname/IP. To pass other parameters, use roster_defaults.

ssh_known_hosts_file: /Users/user1/.ssh/known_hosts
roster_defaults:
  user: user1
  sudo: True

Now you can use the module

salt-ssh --roster sshknownhosts '*' -r "echo hi"

Or with a Saltfile

salt-ssh:
  ssh_known_hosts_file: /Users/user1/.ssh/known_hosts
salt-ssh --roster sshknownhosts '*' -r "echo hi"
salt.roster.sshknownhosts.targets(tgt, tgt_type='glob')

Return the targets from a known_hosts file