Last active
July 23, 2020 17:39
-
-
Save seidler2547/ad21a608cb1046ed9a0f451ac903c9ea to your computer and use it in GitHub Desktop.
Proxmox SSH key exchange Puppet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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