Created
April 1, 2014 18:52
-
-
Save adamcrews/9920571 to your computer and use it in GitHub Desktop.
auth_keys
This file contains 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 profile::ssh { | |
# this installs ssh server, makes it start, ect. | |
# my current favorite is https://forge.puppetlabs.com/saz/ssh | |
include ssh | |
} | |
define myssh::authkeys_file ( | |
$user = root, | |
$group = root, | |
$keygroup = 'default', | |
) { | |
# $name is set to whatever we call this define as. | |
# so usage is myssh::authkeys_file { '/root': keygroup => 'cluster' } | |
$homedir = $name | |
file { "${homedir}/.ssh": | |
ensure => directory, | |
mode => '0700', | |
owner => $user, | |
group => $group, | |
} | |
file { "${homedir}/.ssh/authorized_keys": | |
ensure => file, | |
mode => '0600', | |
owner => $user, | |
group => $group, | |
source => "puppet:///modules/${module_name}/authorized_keys.${keygroup}" | |
} | |
} | |
node /*.int.domain.de$/ { | |
include profile::ssh | |
myssh::authkeys_file { '/root': | |
keygroup => 'cluster', | |
} | |
} | |
# this is more specific than the regex, so it matches this host instead of the regex | |
node 'bob.int.domain.de' { | |
include profile::ssh | |
myssh::authkeys_file { '/root': | |
keygroup => 'special', | |
} | |
} | |
node 'workstation.adam.vm' { | |
include profile::ssh | |
myssh::authkeys_file { '/home/adam': | |
keygroup => default, | |
owner => 'adam', | |
group => 'adam', | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment