]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/blame - modules/base_installation/manifests/puppet.pp
Fix puppet version
[perso/Immae/Projets/Puppet.git] / modules / base_installation / manifests / puppet.pp
CommitLineData
54806111
IB
1class base_installation::puppet (
2 $password_seed = $base_installation::puppet_pass_seed
3) inherits base_installation {
4 File {
5 mode => "0600",
6 owner => "root",
7 group => "root",
8 }
9
10 exec { 'generate_password_seed':
11 command => "/usr/bin/openssl rand -base64 -out $password_seed 256",
12 creates => $password_seed,
13 environment => "RANDFILE=/dev/null",
14 }
15
22e79acd
IB
16 ### Until puppet fixes hist gettext-setup gem use
17 package { 'gem:gettext-setup':
18 name => "gettext-setup",
19 ensure => present,
20 provider => "gem",
21 install_options => "--no-user-install"
22 }
23
24 file { '/usr/lib/ruby/vendor_ruby/locales/':
25 ensure => link,
26 target => "/opt/puppetlabs/puppet/share/locale/",
27 }
28 ###
29
e3cc4c31
IB
30 file { '/usr/local/sbin/i_puppet_lock':
31 mode => "0755",
32 ensure => present,
33 source => "puppet:///modules/base_installation/scripts/puppet_lock"
34 }
35
2499f7e7
IB
36 file { '/usr/local/sbin/i_puppet_reset_and_apply':
37 mode => "0755",
38 ensure => present,
39 source => "puppet:///modules/base_installation/scripts/puppet_reset_and_apply"
40 }
41
42 file { '/usr/local/sbin/i_puppet_report_print':
43 mode => "0755",
44 ensure => present,
45 source => "puppet:///modules/base_installation/scripts/report_print.rb"
46 }
47
cfa8eb92
IB
48 file { '/usr/local/sbin/puppet_apply':
49 mode => "0755",
50 ensure => present,
51 source => "puppet:///modules/base_installation/scripts/puppet_apply",
52 }
53
54806111
IB
54 unless empty(find_file($password_seed)) {
55 $ldap_password = generate_password(24, $password_seed, "ldap")
56 $ssha_ldap_seed = generate_password(5, $password_seed, "ldap_seed")
57
58 package { 'gem:ruby-ldap':
59 name => "ruby-ldap",
60 ensure => present,
61 provider => "gem",
62 install_options => "--no-user-install"
63 }
64
cdbbfd47
IB
65 package { 'gem:xmpp4r':
66 name => "xmpp4r",
67 ensure => present,
68 provider => "gem",
69 install_options => "--no-user-install"
70 }
71
54806111
IB
72 file { $password_seed:
73 mode => "0600",
74 }
75
76 file { $base_installation::puppet_conf_path:
77 ensure => directory,
98776bef 78 require => [Package["puppet5"], Package["gem:xmpp4r"], Package["gem:ruby-ldap"]],
54806111
IB
79 recurse => true,
80 purge => true,
81 force => true,
82 }
83
cdbbfd47 84 $xmpp = lookup("base_installation::notify_xmpp", { "default_value" => {} })
c8511b20 85 $slack = lookup("base_installation::notify_slack", { "default_value" => {} })
cdbbfd47 86
54806111
IB
87 file { "$base_installation::puppet_conf_path/puppet.conf":
88 content => template("base_installation/puppet/puppet.conf.erb"),
89 require => File[$base_installation::puppet_conf_path],
90 }
91
cdbbfd47
IB
92 unless empty($xmpp) {
93 file { "$base_installation::puppet_conf_path/xmpp.yaml":
94 content => template("base_installation/puppet/xmpp.yaml.erb"),
95 require => File[$base_installation::puppet_conf_path],
96 }
97 }
98
c8511b20
IB
99 unless empty($slack) {
100 file { "$base_installation::puppet_conf_path/slack.yaml":
101 content => template("base_installation/puppet/slack.yaml.erb"),
102 require => File[$base_installation::puppet_conf_path],
103 }
104 }
105
a7b985dd 106 if file("$base_installation::puppet_notifies_path/host_ldap.info", "/dev/null") != "" and
036a3f5c
IB
107 empty($facts["ldapvar"]) {
108 fail("LDAP was activated but facts are not available")
109 }
110
a7b985dd
IB
111 file { $base_installation::puppet_notifies_path:
112 ensure => directory,
98776bef 113 require => [Package["puppet5"], Package["gem:xmpp4r"], Package["gem:ruby-ldap"]],
a7b985dd
IB
114 recurse => true,
115 purge => true,
116 force => true,
117 }
118
0a21fb6c 119 $ips = lookup("ips", { 'default_value' => undef })
a7b985dd 120 concat { "$base_installation::puppet_notifies_path/host_ldap.info":
7dc85dc7
IB
121 ensure => "present",
122 mode => "0600",
a7b985dd 123 require => File[$base_installation::puppet_notifies_path],
7dc85dc7
IB
124 ensure_newline => true,
125 }
126
127 concat::fragment { "host_ldap add top":
a7b985dd 128 target => "$base_installation::puppet_notifies_path/host_ldap.info",
7dc85dc7
IB
129 content => template("base_installation/puppet/host_ldap_add_top.info.erb"),
130 order => "00-01",
131 }
132 concat::fragment { "host_ldap add bottom":
a7b985dd 133 target => "$base_installation::puppet_notifies_path/host_ldap.info",
7dc85dc7
IB
134 content => "EOF",
135 order => "00-99",
136 }
137
138 concat::fragment { "host_ldap mod top":
a7b985dd 139 target => "$base_installation::puppet_notifies_path/host_ldap.info",
7dc85dc7
IB
140 content => template("base_installation/puppet/host_ldap_mod_top.info.erb"),
141 order => "01-01",
142 }
143 concat::fragment { "host_ldap mod bottom":
a7b985dd 144 target => "$base_installation::puppet_notifies_path/host_ldap.info",
7dc85dc7
IB
145 content => "EOF",
146 order => "01-99",
54806111 147 }
54806111
IB
148 }
149}