From 0a21fb6c2c52ca5cc2dfdfc41ca0a51c0d81296c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Tue, 13 Mar 2018 13:23:17 +0100 Subject: Start to cleanup the files --- modules/base_installation/manifests/puppet.pp | 2 +- modules/base_installation/manifests/services.pp | 2 +- modules/base_installation/manifests/users.pp | 20 ++++++++++++-------- 3 files changed, 14 insertions(+), 10 deletions(-) (limited to 'modules/base_installation') diff --git a/modules/base_installation/manifests/puppet.pp b/modules/base_installation/manifests/puppet.pp index b3ce492..6f7732d 100644 --- a/modules/base_installation/manifests/puppet.pp +++ b/modules/base_installation/manifests/puppet.pp @@ -67,7 +67,7 @@ class base_installation::puppet ( require => File[$base_installation::puppet_conf_path], } - $ips = lookup("ips") |$key| { {} } + $ips = lookup("ips", { 'default_value' => undef }) file { "$base_installation::puppet_conf_path/host_ldap.info": content => template("base_installation/puppet/host_ldap.info.erb"), require => File[$base_installation::puppet_conf_path], diff --git a/modules/base_installation/manifests/services.pp b/modules/base_installation/manifests/services.pp index c641f4b..d7b4d61 100644 --- a/modules/base_installation/manifests/services.pp +++ b/modules/base_installation/manifests/services.pp @@ -38,7 +38,7 @@ class base_installation::services inherits base_installation { group => "root" } - $ip6 = lookup("ips.v6") |$key| { {} } + $ip6 = lookup("ips.v6", { 'default_value' => undef }) file { '/etc/systemd/network/en-dhcp.network': ensure => "present", path => "/etc/systemd/network/en-dhcp.network", diff --git a/modules/base_installation/manifests/users.pp b/modules/base_installation/manifests/users.pp index 766c0f0..f893c51 100644 --- a/modules/base_installation/manifests/users.pp +++ b/modules/base_installation/manifests/users.pp @@ -26,22 +26,26 @@ class base_installation::users ( ensure => "present", groups => $user[groups], managehome => true, + system => !!$user[system], home => "/home/${user[username]}", - notify => Exec["remove_password"], + notify => Exec["remove_password:${user[username]}:${user[userid]}"], purge_ssh_keys => true } - exec { "remove_password": + exec { "remove_password:${user[username]}:${user[userid]}": command => "/usr/bin/chage -d 0 ${user[username]} && /usr/bin/passwd -d ${user[username]}", + onlyif => "/usr/bin/test -z '${user[password]}'", refreshonly => true } - $user[keys].each |$key| { - ssh_authorized_key { "${user[username]}@${key[host]}": - name => "${user[username]}@${key[host]}", - user => $user[username], - type => $key[key_type], - key => $key[key], + if has_key($user, "keys") { + $user[keys].each |$key| { + ssh_authorized_key { "${user[username]}@${key[host]}": + name => "${user[username]}@${key[host]}", + user => $user[username], + type => $key[key_type], + key => $key[key], + } } } } -- cgit v1.2.3