Skip to content

Instantly share code, notes, and snippets.

@seidler2547
Last active July 23, 2020 17:39
Show Gist options
  • Save seidler2547/ad21a608cb1046ed9a0f451ac903c9ea to your computer and use it in GitHub Desktop.
Save seidler2547/ad21a608cb1046ed9a0f451ac903c9ea to your computer and use it in GitHub Desktop.
Proxmox SSH key exchange Puppet
class mymod::proxmox {
$loc = downcase(hiera('hostgroup'))
tag "hostgroup-$loc"
@@sshkey { "$hostname":
ensure => present,
host_aliases => [ $fqdn, $facts['networking']['ip'] ],
type => "rsa",
key => $sshrsakey,
}
Sshkey <<| tag == "hostgroup-$loc" |>>
@@Mymod::ssh_user { "root@${fqdn}:root": }
Mymod::Ssh_user <<| tag == "hostgroup-$loc" |>>
}
define mymod::ssh_user() {
$def = split($title, ':')
sshkeys::set_authorized_key { "allow ${def[0]} as ${def[1]}":
remote_user => $def[0],
local_user => $def[1],
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment