diff options
author | Jesse Luehrs <doy@tozt.net> | 2017-11-05 01:39:36 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2017-11-05 01:39:36 -0500 |
commit | c919177b6d329200f08fdbf0b08738a908087132 (patch) | |
tree | 48b1b144bbb1df66565fac22a33d19ed198a1904 | |
parent | 3684358a4d0af2e44a6bf5acf30dcc8c4c16fff6 (diff) | |
download | puppet-tozt-c919177b6d329200f08fdbf0b08738a908087132.tar.gz puppet-tozt-c919177b6d329200f08fdbf0b08738a908087132.zip |
more refactoring
-rw-r--r-- | manifest.pp | 10 | ||||
-rw-r--r-- | modules/conf/manifests/init.pp | 26 | ||||
-rw-r--r-- | modules/doy/manifests/conf.pp | 4 | ||||
-rw-r--r-- | modules/doy/manifests/user.pp | 29 | ||||
-rw-r--r-- | modules/root/manifests/conf.pp | 4 | ||||
-rw-r--r-- | modules/root/manifests/user.pp | 8 | ||||
-rw-r--r-- | modules/tozt/files/tozt-puppet (renamed from modules/bootstrap/files/tozt-puppet) | 0 | ||||
-rw-r--r-- | modules/tozt/manifests/bootstrap.pp (renamed from modules/bootstrap/manifests/init.pp) | 0 | ||||
-rw-r--r-- | modules/tozt/manifests/user.pp | 37 | ||||
-rw-r--r-- | modules/tozt/manifests/users.pp | 10 |
10 files changed, 63 insertions, 65 deletions
diff --git a/manifest.pp b/manifest.pp index c91e628..fb98abc 100644 --- a/manifest.pp +++ b/manifest.pp @@ -1,11 +1,5 @@ +include tozt::users +include tozt::bootstrap include tozt::mail include tozt::site include tozt::other_packages - -include doy::user -include doy::conf - -include root::user -include root::conf - -include bootstrap diff --git a/modules/conf/manifests/init.pp b/modules/conf/manifests/init.pp index 30159a2..a14c560 100644 --- a/modules/conf/manifests/init.pp +++ b/modules/conf/manifests/init.pp @@ -1,15 +1,17 @@ -define conf { - $user = $name - $home = $user ? { - 'root' => '/root', - default => "/home/$user", +define conf($user=$name, $home=undef) { + $_home = $home ? { + undef => $user ? { + 'root' => '/root', + default => "/home/$user", + }, + default => $home, } exec { "git clone doy/conf for $user": command => "/usr/bin/git clone git://github.com/doy/conf", user => $user, - cwd => $home, - creates => "$home/conf", + cwd => $_home, + creates => "$_home/conf", require => [ User[$user], Package["git"], @@ -19,12 +21,12 @@ define conf { exec { "conf make install for $user": command => "/usr/bin/make install", user => $user, - cwd => "$home/conf", + cwd => "$_home/conf", environment => [ - "HOME=$home", - "PWD=$home/conf", + "HOME=$_home", + "PWD=$_home/conf", ], - creates => "$home/.vimrc", + creates => "$_home/.vimrc", require => [ User[$user], Exec["git clone doy/conf for $user"], @@ -35,6 +37,6 @@ define conf { Package["fortune-mod"], Package["less"], Package["gcc"], - ], + ]; } } diff --git a/modules/doy/manifests/conf.pp b/modules/doy/manifests/conf.pp deleted file mode 100644 index 3906b94..0000000 --- a/modules/doy/manifests/conf.pp +++ /dev/null @@ -1,4 +0,0 @@ -class doy::conf { - conf { "doy": - } -} diff --git a/modules/doy/manifests/user.pp b/modules/doy/manifests/user.pp deleted file mode 100644 index cf81a9c..0000000 --- a/modules/doy/manifests/user.pp +++ /dev/null @@ -1,29 +0,0 @@ -class doy::user { - group { 'doy': - ensure => 'present'; - } - - user { 'doy': - ensure => 'present', - gid => 'doy', - groups => ['wheel'], - home => '/home/doy', - shell => '/usr/bin/zsh', - password => '$6$qOA.wLmjTYa$MIVQkEqcSb3p.YxuhGTRw8fFhto5Lru06JpibfzxO2Ps.ezyvAJeoFHSPInzfjTaNxETl48ERWmQaPuZMAqF1.', - require => [ - Group['doy'], - Package['zsh'], - ]; - } - - file { '/home/doy': - ensure => 'directory', - owner => 'doy', - group => 'doy', - mode => '0700', - require => [ - User['doy'], - Group['doy'], - ]; - } -} diff --git a/modules/root/manifests/conf.pp b/modules/root/manifests/conf.pp deleted file mode 100644 index 2bcc214..0000000 --- a/modules/root/manifests/conf.pp +++ /dev/null @@ -1,4 +0,0 @@ -class root::conf { - conf { 'root': - } -} diff --git a/modules/root/manifests/user.pp b/modules/root/manifests/user.pp deleted file mode 100644 index 7499e0c..0000000 --- a/modules/root/manifests/user.pp +++ /dev/null @@ -1,8 +0,0 @@ -class root::user { - user { 'root': - ensure => 'present', - shell => '/usr/bin/zsh', - password => '$6$eL/FXVccr$zBigeOVvTeo0NYzV85X8uodfg..Pc6U.rcYC7DspwfZJzI6AM5yTr4qzkkMzQBIonsiXtpQ.SD33JOOjKlmDo/', - require => Package['zsh']; - } -} diff --git a/modules/bootstrap/files/tozt-puppet b/modules/tozt/files/tozt-puppet index bad67dd..bad67dd 100644 --- a/modules/bootstrap/files/tozt-puppet +++ b/modules/tozt/files/tozt-puppet diff --git a/modules/bootstrap/manifests/init.pp b/modules/tozt/manifests/bootstrap.pp index c7bceec..c7bceec 100644 --- a/modules/bootstrap/manifests/init.pp +++ b/modules/tozt/manifests/bootstrap.pp diff --git a/modules/tozt/manifests/user.pp b/modules/tozt/manifests/user.pp new file mode 100644 index 0000000..34aff21 --- /dev/null +++ b/modules/tozt/manifests/user.pp @@ -0,0 +1,37 @@ +define tozt::user( + $pwhash, + $user=$name, + $group=$user, + $home=undef, + $extra_groups=[], + $shell='/usr/bin/zsh', +) { + $_home = $home ? { + undef => $user ? { + 'root' => '/root', + default => "/home/$user", + }, + default => $home, + } + + group { $group: + ensure => present; + } + + user { $user: + ensure => 'present', + gid => $group, + groups => $extra_groups, + home => $_home, + shell => $shell, + password => $pwhash, + require => Group[$group]; + } + + conf { $user: + } + + if $shell == '/usr/bin/zsh' { + Package['zsh'] -> User[$user] + } +} diff --git a/modules/tozt/manifests/users.pp b/modules/tozt/manifests/users.pp new file mode 100644 index 0000000..b7d9807 --- /dev/null +++ b/modules/tozt/manifests/users.pp @@ -0,0 +1,10 @@ +class tozt::users { + tozt::user { 'root': + pwhash => '$6$cqlzoze/Mq3$bHGFqjPF6wBRLcI0VWuQa9cg8c1DfGWL21QdA9KUuDqhtnCfjyaKryu.ACxP9umzuYsWpikegZN6wbTU2JX6V1'; + } + + tozt::user { 'doy': + pwhash => '$6$Q6Y/nmt/QZbU$6D692oUPiFvnQEwoPtL7l83l/KaY/czy9/KI9.GnEEOslQumU39qteDDp.0i9E7nSDodWGOmPgfAsoYJBYrta1', + extra_groups => ['wheel']; + } +} |