From 96943608ea4a83ec6978c955ce1e1011c64e668e Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sun, 16 Mar 2014 16:54:37 -0300 Subject: Defining nodo::subsystem::ssh_folder as resource type --- manifests/defines/ssh_config.pp | 2 +- manifests/defines/ssh_create_key.pp | 2 +- manifests/defines/ssh_folder.pp | 15 +++++++++++++++ manifests/defines/ssh_known_hosts.pp | 2 +- manifests/defines/ssh_local_key.pp | 2 +- manifests/subsystem/ssh_folder.pp | 15 --------------- 6 files changed, 19 insertions(+), 19 deletions(-) create mode 100644 manifests/defines/ssh_folder.pp delete mode 100644 manifests/subsystem/ssh_folder.pp diff --git a/manifests/defines/ssh_config.pp b/manifests/defines/ssh_config.pp index d071822..5585520 100644 --- a/manifests/defines/ssh_config.pp +++ b/manifests/defines/ssh_config.pp @@ -5,7 +5,7 @@ define ssh_config( $home = '/home/$owner', $ssh_localhost_auth = false ) { - class { "nodo::subsystem::ssh_folder": + ssh_folder { "ssh-config-${name}": home => $home, owner => $owner, group => $group, diff --git a/manifests/defines/ssh_create_key.pp b/manifests/defines/ssh_create_key.pp index 3608b7e..77d1f00 100644 --- a/manifests/defines/ssh_create_key.pp +++ b/manifests/defines/ssh_create_key.pp @@ -4,7 +4,7 @@ define ssh_create_key( $keyfile = 'id_rsa', $home = '/home/$owner' ) { - class { "nodo::subsystem::ssh_folder": + ssh_folder { "ssh_create_key-${name}": home => $home, owner => $owner, group => $group, diff --git a/manifests/defines/ssh_folder.pp b/manifests/defines/ssh_folder.pp new file mode 100644 index 0000000..e61ec02 --- /dev/null +++ b/manifests/defines/ssh_folder.pp @@ -0,0 +1,15 @@ +# Manage a ssh folder +define ssh_folder( + $home, + $owner, + $group, +) { + if !defined(File["${home}/.ssh"]) { + file { "${home}/.ssh": + ensure => directory, + owner => $owner, + group => $group, + mode => 0700, + } + } +} diff --git a/manifests/defines/ssh_known_hosts.pp b/manifests/defines/ssh_known_hosts.pp index dad17ac..c0d7157 100644 --- a/manifests/defines/ssh_known_hosts.pp +++ b/manifests/defines/ssh_known_hosts.pp @@ -4,7 +4,7 @@ define ssh_known_host( $home = '/home/$owner', $ssh_localhost_auth = false ) { - class { "nodo::subsystem::ssh_folder": + ssh_folder { "ssh_known_host-${name}": home => $home, owner => $owner, group => $group, diff --git a/manifests/defines/ssh_local_key.pp b/manifests/defines/ssh_local_key.pp index 99d8361..f2828a2 100644 --- a/manifests/defines/ssh_local_key.pp +++ b/manifests/defines/ssh_local_key.pp @@ -7,7 +7,7 @@ define ssh_local_key( $dest = 'id_rsa', $ensure = 'present', ) { - class { "nodo::subsystem::ssh_folder": + ssh_folder { "ssh_local_key-${name}": home => $home, owner => $owner, group => $group, diff --git a/manifests/subsystem/ssh_folder.pp b/manifests/subsystem/ssh_folder.pp deleted file mode 100644 index 89e91a6..0000000 --- a/manifests/subsystem/ssh_folder.pp +++ /dev/null @@ -1,15 +0,0 @@ -# Base class -class nodo::subsystem::ssh_folder( - $home, - $owner, - $group, -) { - if !defined(File["${home}/.ssh"]) { - file { "${home}/.ssh": - ensure => directory, - owner => $owner, - group => $group, - mode => 0700, - } - } -} -- cgit v1.2.3