aboutsummaryrefslogtreecommitdiff
path: root/modules/base_installation
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2018-03-22 11:50:12 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2018-03-22 12:48:17 +0100
commitcdbbfd477be98497ca89233ca8b8b1c1e27e184b (patch)
treefbd6fb8d4d4cd337a4ffbec24d7f0530b5596de8 /modules/base_installation
parent5a1aab82ab45c14db40026bb7b1f19d0ee8a3cb3 (diff)
downloadPuppet-cdbbfd477be98497ca89233ca8b8b1c1e27e184b.tar.gz
Puppet-cdbbfd477be98497ca89233ca8b8b1c1e27e184b.tar.zst
Puppet-cdbbfd477be98497ca89233ca8b8b1c1e27e184b.zip
XMPP notification
Diffstat (limited to 'modules/base_installation')
-rw-r--r--modules/base_installation/manifests/puppet.pp18
-rw-r--r--modules/base_installation/templates/puppet/puppet.conf.erb5
-rw-r--r--modules/base_installation/templates/puppet/xmpp.yaml.erb11
3 files changed, 33 insertions, 1 deletions
diff --git a/modules/base_installation/manifests/puppet.pp b/modules/base_installation/manifests/puppet.pp
index 0cb43bc..c64ddfd 100644
--- a/modules/base_installation/manifests/puppet.pp
+++ b/modules/base_installation/manifests/puppet.pp
@@ -56,23 +56,39 @@ class base_installation::puppet (
56 install_options => "--no-user-install" 56 install_options => "--no-user-install"
57 } 57 }
58 58
59 package { 'gem:xmpp4r':
60 name => "xmpp4r",
61 ensure => present,
62 provider => "gem",
63 install_options => "--no-user-install"
64 }
65
59 file { $password_seed: 66 file { $password_seed:
60 mode => "0600", 67 mode => "0600",
61 } 68 }
62 69
63 file { $base_installation::puppet_conf_path: 70 file { $base_installation::puppet_conf_path:
64 ensure => directory, 71 ensure => directory,
65 require => [Package["puppet"], Package["gem:ruby-ldap"]], 72 require => [Package["puppet"], Package["gem:xmpp4r"], Package["gem:ruby-ldap"]],
66 recurse => true, 73 recurse => true,
67 purge => true, 74 purge => true,
68 force => true, 75 force => true,
69 } 76 }
70 77
78 $xmpp = lookup("base_installation::notify_xmpp", { "default_value" => {} })
79
71 file { "$base_installation::puppet_conf_path/puppet.conf": 80 file { "$base_installation::puppet_conf_path/puppet.conf":
72 content => template("base_installation/puppet/puppet.conf.erb"), 81 content => template("base_installation/puppet/puppet.conf.erb"),
73 require => File[$base_installation::puppet_conf_path], 82 require => File[$base_installation::puppet_conf_path],
74 } 83 }
75 84
85 unless empty($xmpp) {
86 file { "$base_installation::puppet_conf_path/xmpp.yaml":
87 content => template("base_installation/puppet/xmpp.yaml.erb"),
88 require => File[$base_installation::puppet_conf_path],
89 }
90 }
91
76 $ips = lookup("ips", { 'default_value' => undef }) 92 $ips = lookup("ips", { 'default_value' => undef })
77 file { "$base_installation::puppet_conf_path/host_ldap.info": 93 file { "$base_installation::puppet_conf_path/host_ldap.info":
78 content => template("base_installation/puppet/host_ldap.info.erb"), 94 content => template("base_installation/puppet/host_ldap.info.erb"),
diff --git a/modules/base_installation/templates/puppet/puppet.conf.erb b/modules/base_installation/templates/puppet/puppet.conf.erb
index 24e67c8..37eba8e 100644
--- a/modules/base_installation/templates/puppet/puppet.conf.erb
+++ b/modules/base_installation/templates/puppet/puppet.conf.erb
@@ -1,4 +1,9 @@
1[main] 1[main]
2<% if @xmpp.count > 0 %>
3reports = store,xmpp
4<% else %>
5reports = store
6<% end %>
2ssldir = <%= @puppet_ssl_path %> 7ssldir = <%= @puppet_ssl_path %>
3 8
4environment = <%= @environment %> 9environment = <%= @environment %>
diff --git a/modules/base_installation/templates/puppet/xmpp.yaml.erb b/modules/base_installation/templates/puppet/xmpp.yaml.erb
new file mode 100644
index 0000000..572f472
--- /dev/null
+++ b/modules/base_installation/templates/puppet/xmpp.yaml.erb
@@ -0,0 +1,11 @@
1:xmpp_password: "<%= @xmpp["password"] %>"
2:xmpp_jid: "<%= @xmpp["jid"] %>/<%= @real_hostname %>"
3:xmpp_target: "<%= @xmpp["target"] %>"
4<% if @xmpp["statuses"].is_a?(String) %>
5:xmpp_statuses: "<%= @xmpp["statuses"] %>"
6<% else %>
7:xmpp_statuses:
8<% @xmpp["statuses"].each do |status| %>
9 - <%= status %>
10<% end %>
11<% end %>