diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2015-09-11 21:16:42 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2015-09-11 21:16:42 -0300 |
commit | 76ec4642be1a8bc64380c077a5890c4d0f4243e0 (patch) | |
tree | e31930271b7eefb3c3d693264e012e8ff45832ae /manifests/subsystem/ssh/local_key.pp | |
parent | 6509060a791daeeee13c40f9367489ac5e00880e (diff) | |
download | puppet-nodo-76ec4642be1a8bc64380c077a5890c4d0f4243e0.tar.gz puppet-nodo-76ec4642be1a8bc64380c077a5890c4d0f4243e0.tar.bz2 |
Autoload definitions
Diffstat (limited to 'manifests/subsystem/ssh/local_key.pp')
-rw-r--r-- | manifests/subsystem/ssh/local_key.pp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/manifests/subsystem/ssh/local_key.pp b/manifests/subsystem/ssh/local_key.pp new file mode 100644 index 0000000..f311ea3 --- /dev/null +++ b/manifests/subsystem/ssh/local_key.pp @@ -0,0 +1,43 @@ +# Manage local ssh keys +define nodo::subsystem::ssh::local_key( + $owner = $name, + $group = $name, + $home = "/home/${owner}", + $source = "puppet:///ssh/${name}_id_rsa", + $dest = 'id_rsa', + $ensure = 'present', +) { + nodo::subsystem::ssh::folder { "ssh_local_key-${name}": + home => $home, + owner => $owner, + group => $group, + ensure => $ensure ? { + 'present' => 'directory', + default => 'absent', + }, + } + + file { "${home}/.ssh/${dest}": + ensure => $ensure, + owner => $owner, + group => $group, + mode => 0400, + source => $ensure ? { + 'present' => $source, + default => undef, + }, + require => File["${home}/.ssh"], + } + + file { "${home}/.ssh/${dest}.pub": + ensure => $ensure, + owner => $owner, + group => $group, + mode => 0400, + source => $ensure ? { + 'present' => "${source}.pub", + default => undef, + }, + require => File["${home}/.ssh"], + } +} |