aboutsummaryrefslogtreecommitdiff
path: root/manifests/server.pp
diff options
context:
space:
mode:
Diffstat (limited to 'manifests/server.pp')
-rw-r--r--manifests/server.pp70
1 files changed, 47 insertions, 23 deletions
diff --git a/manifests/server.pp b/manifests/server.pp
index 382764b..157827a 100644
--- a/manifests/server.pp
+++ b/manifests/server.pp
@@ -105,34 +105,41 @@ class backupninja::server {
nagios2::passive_service { "backups-${name}": nagios2_host_name => $real_host, nagios2_description => $real_nagios2_description, servicegroups => "backups" }
}
- if !defined(File["$real_backuptag-$real_dir"]) {
- @@file { "$real_backuptag-$real_dir":
- path => "$real_dir",
+ if !defined(File["$real_dir"]) {
+ @@file { "$real_dir":
ensure => directory,
- mode => 0750, owner => $real_user, group => 0,
- tag => "$real_backuptag",
+ mode => 0750, owner => $real_user, group => 0,
+ tag => "$real_backuptag",
+ }
+ }
+ else {
+ File <| title == "$real_dir" |> {
+ tag +> "$real_backuptag",
}
}
case $installuser {
true: {
case $manage_ssh_dir {
true: {
- if !defined(File["$real_backuptag-$real_ssh_dir"]) {
- @@file { "$real_backuptag-${real_ssh_dir}":
- path => "${real_ssh_dir}",
- ensure => directory,
- mode => 0700, owner => $real_user, group => 0,
+ if !defined(File["$real_ssh_dir"]) {
+ @@file { "${real_ssh_dir}":
+ ensure => directory,
+ mode => 0700, owner => $real_user, group => 0,
require => [User[$real_user], File["$real_dir"]],
- tag => "$real_backuptag",
+ tag => "$real_backuptag",
+ }
+ }
+ else {
+ File <| title == "$real_ssh_dir" |> {
+ tag +> "$real_backuptag",
}
}
}
}
case $key {
false: {
- if !defined(File["$real_backuptag-${real_ssh_dir}/${real_authorized_keys_file}"]) {
- @@file { "$real_backuptag-${real_ssh_dir}/${real_authorized_keys_file}":
- path => "${real_ssh_dir}/${real_authorized_keys_file",
+ if !defined(File["${real_ssh_dir}/${real_authorized_keys_file}"]) {
+ @@file { "${real_ssh_dir}/${real_authorized_keys_file}":
ensure => present,
mode => 0644, owner => 0, group => 0,
source => "$real_backupkeys/${real_user}_id_${keytype}.pub",
@@ -140,11 +147,15 @@ class backupninja::server {
tag => "$real_backuptag",
}
}
+ else {
+ File <| title == "${real_ssh_dir}/${real_authorized_keys_file}" |> {
+ tag +> "$real_backuptag",
+ }
+ }
}
default: {
- if !defined(Ssh_autorized_key["$real_backuptag-$real_user"]) {
- @@ssh_authorized_key{ "$real_backuptag-$real_user":
- name => "$real_user",
+ if !defined(Ssh_autorized_key["$real_user"]) {
+ @@ssh_authorized_key{ "$real_user":
type => $keytype,
key => $key,
user => $real_user,
@@ -153,13 +164,17 @@ class backupninja::server {
require => User[$real_user],
}
}
+ else {
+ Ssh_authorized_key <| title == "$real_user" |> {
+ tag +> "$real_backuptag",
+ }
+ }
}
}
case $uid {
false: {
- if !defined(User["$real_backuptag-$real_user"]) {
- @@user { "$real_backuptag-$real_user":
- name => "$real_user",
+ if !defined(User["$real_user"]) {
+ @@user { "$real_user":
ensure => "present",
gid => "$gid",
comment => "$name backup sandbox",
@@ -171,11 +186,15 @@ class backupninja::server {
tag => "$real_backuptag"
}
}
+ else {
+ User <| title == "$real_user" |> {
+ tag +> "$real_backuptag",
+ }
+ }
}
default: {
- if !defined(User["$real_backuptag-$real_user"]) {
- @@user { "$real_backuptag-$real_user":
- name => "$real_user",
+ if !defined(User["$real_user"]) {
+ @@user { "$real_user":
ensure => "present",
uid => "$uid",
gid => "$gid",
@@ -188,6 +207,11 @@ class backupninja::server {
tag => "$real_backuptag"
}
}
+ else {
+ User <| title == "$real_user" |> {
+ tag +> "$real_backuptag",
+ }
+ }
}
}
}