aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-03-16 16:51:27 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-03-16 16:51:27 -0300
commit5055135b544026487c79d3cc71cfebf94c1fd994 (patch)
tree446619c88d3f49367f9afc4cd4d6e6efbb2a34a0
parent99db24c24f9dae32a573b7d33eb8ed4feb3494b4 (diff)
downloadpuppet-nodo-5055135b544026487c79d3cc71cfebf94c1fd994.tar.gz
puppet-nodo-5055135b544026487c79d3cc71cfebf94c1fd994.tar.bz2
Defining nodo::subsystem::ssh_folder as a parametrized class
-rw-r--r--manifests/defines/ssh_config.pp7
-rw-r--r--manifests/defines/ssh_create_key.pp6
-rw-r--r--manifests/defines/ssh_known_hosts.pp6
-rw-r--r--manifests/defines/ssh_local_key.pp6
-rw-r--r--manifests/subsystem/ssh_folder.pp6
5 files changed, 26 insertions, 5 deletions
diff --git a/manifests/defines/ssh_config.pp b/manifests/defines/ssh_config.pp
index 79d9635..d071822 100644
--- a/manifests/defines/ssh_config.pp
+++ b/manifests/defines/ssh_config.pp
@@ -1,10 +1,15 @@
# Manage ssh config for a particular user
define ssh_config(
$owner,
+ $group,
$home = '/home/$owner',
$ssh_localhost_auth = false
) {
- include nodo::subsystem::ssh_folder
+ class { "nodo::subsystem::ssh_folder":
+ home => $home,
+ owner => $owner,
+ group => $group,
+ }
file { "${home}/.ssh/config":
ensure => present,
diff --git a/manifests/defines/ssh_create_key.pp b/manifests/defines/ssh_create_key.pp
index ec4bb67..3608b7e 100644
--- a/manifests/defines/ssh_create_key.pp
+++ b/manifests/defines/ssh_create_key.pp
@@ -4,7 +4,11 @@ define ssh_create_key(
$keyfile = 'id_rsa',
$home = '/home/$owner'
) {
- include nodo::subsystem::ssh_folder
+ class { "nodo::subsystem::ssh_folder":
+ home => $home,
+ owner => $owner,
+ group => $group,
+ }
exec { "ssh-keygen-${owner}":
command => "ssh-keygen -t rsa -P '' -f ${home}/.ssh/${keyfile}",
diff --git a/manifests/defines/ssh_known_hosts.pp b/manifests/defines/ssh_known_hosts.pp
index 84f25b2..dad17ac 100644
--- a/manifests/defines/ssh_known_hosts.pp
+++ b/manifests/defines/ssh_known_hosts.pp
@@ -4,7 +4,11 @@ define ssh_known_host(
$home = '/home/$owner',
$ssh_localhost_auth = false
) {
- include nodo::subsystem::ssh_folder
+ class { "nodo::subsystem::ssh_folder":
+ home => $home,
+ owner => $owner,
+ group => $group,
+ }
file { "${home}/.ssh/known_hosts":
ensure => present,
diff --git a/manifests/defines/ssh_local_key.pp b/manifests/defines/ssh_local_key.pp
index be6ccd8..99d8361 100644
--- a/manifests/defines/ssh_local_key.pp
+++ b/manifests/defines/ssh_local_key.pp
@@ -7,7 +7,11 @@ define ssh_local_key(
$dest = 'id_rsa',
$ensure = 'present',
) {
- include nodo::subsystem::ssh_folder
+ class { "nodo::subsystem::ssh_folder":
+ home => $home,
+ owner => $owner,
+ group => $group,
+ }
file { "${home}/.ssh/${dest}":
ensure => $ensure,
diff --git a/manifests/subsystem/ssh_folder.pp b/manifests/subsystem/ssh_folder.pp
index 1c6ee49..89e91a6 100644
--- a/manifests/subsystem/ssh_folder.pp
+++ b/manifests/subsystem/ssh_folder.pp
@@ -1,5 +1,9 @@
# Base class
-class nodo::subsystem::ssh_folder {
+class nodo::subsystem::ssh_folder(
+ $home,
+ $owner,
+ $group,
+) {
if !defined(File["${home}/.ssh"]) {
file { "${home}/.ssh":
ensure => directory,