Created
April 16, 2020 08:37
-
-
Save seidler2547/e390b186a6ac4d5ca7b767971d18f36c to your computer and use it in GitHub Desktop.
Exchange SSH user and host keys using 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 mybase::jenkins::master { | |
Sshkey <<| tag == 'jenkinsslave' |>> | |
} |
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
# using https://forge.puppet.com/jtopjian/sshkeys | |
class mybase::jenkins::slave($allowed_users = []) { | |
@@sshkey { $fqdn: | |
ensure => present, | |
type => "rsa", | |
key => $sshrsakey, | |
tag => 'jenkinsslave', | |
} | |
ensure_resource('mybase::jenkins::slave::user', $allowed_users, {}) | |
} | |
define mybase::jenkins::slave::user($remoteuser = 'jenkins', $remotehost = 'jenkins.example.com') { | |
sshkeys::set_authorized_key { "allow $remoteuser as $title": | |
local_user => $title, | |
remote_user => "$remoteuser@$remotehost", | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Requires https://forge.puppet.com/jtopjian/sshkeys