]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/commitdiff
XMPP notification
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Thu, 22 Mar 2018 10:50:12 +0000 (11:50 +0100)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Thu, 22 Mar 2018 11:48:17 +0000 (12:48 +0100)
.gitmodules
environments/global/common.yaml
modules/base_installation/manifests/puppet.pp
modules/base_installation/templates/puppet/puppet.conf.erb
modules/base_installation/templates/puppet/xmpp.yaml.erb [new file with mode: 0644]
modules/xmpp [new submodule]

index 735ca8ce9d094f1817ce39c706784470f7c36f79..7a56af5bc999824581677336c71db3c6bc49fee1 100644 (file)
@@ -49,6 +49,9 @@
 [submodule "modules/ssh_keygen"]
        path = modules/ssh_keygen
        url = git://git.immae.eu/github/voxpupuli/puppet-ssh_keygen
+[submodule "modules/xmpp"]
+       path = modules/xmpp
+       url = git://git.immae.eu/github/jamtur01/puppet-xmpp
 [submodule "modules/ssl"]
        path = modules/ssl
        url = git://git.immae.eu/github/fnerdwq/puppet-ssl
index 094e0fff4c04c15a307951d334109fda8fcc483e..2dfe0aa562cb68b36d851c6485d2c9e0bb978fc8 100644 (file)
@@ -29,6 +29,7 @@ base_installation::puppet_ssl_path: "/etc/puppetlabs/ssl"
 base_installation::system_locales: ["fr_FR.UTF-8", "en_US.UTF-8"]
 base_installation::system_timezone: "Europe/Paris"
 base_installation::system_users: [] # Fetched via ldap
+base_installation::notify_xmpp: {}
 profile::fstab::mounts:
   - "%{facts.ldapvar.self.vars.mounts.0}"
   - "%{facts.ldapvar.self.vars.mounts.1}"
index 0cb43bcdd24635ef84df3f9f977e4ceeb5b566ae..c64ddfdccf141095002805c97498f2cd1dc248b2 100644 (file)
@@ -56,23 +56,39 @@ class base_installation::puppet (
       install_options => "--no-user-install"
     }
 
+    package { 'gem:xmpp4r':
+      name            => "xmpp4r",
+      ensure          => present,
+      provider        => "gem",
+      install_options => "--no-user-install"
+    }
+
     file { $password_seed:
       mode => "0600",
     }
 
     file { $base_installation::puppet_conf_path:
       ensure  => directory,
-      require => [Package["puppet"], Package["gem:ruby-ldap"]],
+      require => [Package["puppet"], Package["gem:xmpp4r"], Package["gem:ruby-ldap"]],
       recurse => true,
       purge   => true,
       force   => true,
     }
 
+    $xmpp = lookup("base_installation::notify_xmpp", { "default_value" => {} })
+
     file { "$base_installation::puppet_conf_path/puppet.conf":
       content => template("base_installation/puppet/puppet.conf.erb"),
       require => File[$base_installation::puppet_conf_path],
     }
 
+    unless empty($xmpp) {
+      file { "$base_installation::puppet_conf_path/xmpp.yaml":
+        content => template("base_installation/puppet/xmpp.yaml.erb"),
+        require => File[$base_installation::puppet_conf_path],
+      }
+    }
+
     $ips = lookup("ips", { 'default_value' => undef })
     file { "$base_installation::puppet_conf_path/host_ldap.info":
       content => template("base_installation/puppet/host_ldap.info.erb"),
index 24e67c85c4d5c697f3365640e62c6fa5c9b338b5..37eba8ef0cbc5d151f30048e3df4c03299fa8700 100644 (file)
@@ -1,4 +1,9 @@
 [main]
+<% if @xmpp.count > 0 %>
+reports = store,xmpp
+<% else %>
+reports = store
+<% end %>
 ssldir = <%= @puppet_ssl_path %>
 
 environment = <%= @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 (file)
index 0000000..572f472
--- /dev/null
@@ -0,0 +1,11 @@
+:xmpp_password: "<%= @xmpp["password"] %>"
+:xmpp_jid: "<%= @xmpp["jid"] %>/<%= @real_hostname %>"
+:xmpp_target: "<%= @xmpp["target"] %>"
+<% if @xmpp["statuses"].is_a?(String) %>
+:xmpp_statuses: "<%= @xmpp["statuses"] %>"
+<% else %>
+:xmpp_statuses:
+<% @xmpp["statuses"].each do |status| %>
+  - <%= status %>
+<% end %>
+<% end %>
diff --git a/modules/xmpp b/modules/xmpp
new file mode 160000 (submodule)
index 0000000..d18dd07
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit d18dd07ffdf6c33942bd0c277cb24aafa513cbd7