base_installation::ldap_cn: "%{facts.ec2_metadata.hostname}"
base_installation::ldap_server: "ldap.immae.eu"
base_installation::ldap_uri: "ldaps://ldap.immae.eu"
-# FIXME: get all mounts without needing that hack?
base_installation::puppet_conf_path: "/etc/puppetlabs/puppet"
+base_installation::puppet_notifies_path: "/etc/puppetlabs/notifies"
base_installation::puppet_code_path: "/etc/puppetlabs/code"
base_installation::puppet_pass_seed: "/etc/puppetlabs/puppet/password_seed"
base_installation::puppet_ssl_path: "/etc/puppetlabs/ssl"
base_installation::system_timezone: "Europe/Paris"
base_installation::system_users: [] # Fetched via ldap
base_installation::notify_xmpp: {}
+# FIXME: get all mounts without needing that hack?
profile::fstab::mounts:
- "%{facts.ldapvar.self.vars.mounts.0}"
- "%{facts.ldapvar.self.vars.mounts.1}"
--- /dev/null
+require 'puppet'
+
+Puppet::Reports.register_report(:cat_files) do
+ FOLLOWED_RESOURCES = [
+ "File[/etc/puppetlabs/notifies/host_ldap.info]",
+ ]
+
+ def process
+ self.resource_statuses.each do |name, status|
+ if FOLLOWED_RESOURCES.include?(status.resource) && status.events.any? { |e| e.status == "success" }
+ puts File.open(status.title, "r").read()
+ end
+ end
+ end
+
+end
+
class base_installation (
- Optional[String] $grub_device = $base_installation::params::grub_device,
- Optional[String] $ldap_base = $base_installation::params::ldap_base,
- Optional[String] $ldap_cert_path = $base_installation::params::ldap_cert_path,
- Optional[String] $ldap_cn = $base_installation::params::ldap_cn,
- Optional[String] $ldap_dn = $base_installation::params::ldap_dn,
- Optional[String] $ldap_server = $base_installation::params::ldap_server,
- Optional[String] $ldap_uri = $base_installation::params::ldap_uri,
- Optional[String] $puppet_code_path = $base_installation::params::puppet_code_path,
- Optional[String] $puppet_conf_path = $base_installation::params::puppet_conf_path,
- Optional[String] $puppet_pass_seed = $base_installation::params::puppet_pass_seed,
- Optional[String] $puppet_ssl_path = $base_installation::params::puppet_ssl_path,
- Optional[String] $real_hostname = $base_installation::params::real_hostname,
- Optional[String] $system_hostname = $base_installation::params::system_hostname,
- Optional[Array[String]] $system_locales = $base_installation::params::system_locales,
- Optional[String] $system_timezone = $base_installation::params::system_timezone,
- Optional[Array[Hash]] $system_users = $base_installation::params::system_users,
+ Optional[String] $grub_device = $base_installation::params::grub_device,
+ Optional[String] $ldap_base = $base_installation::params::ldap_base,
+ Optional[String] $ldap_cert_path = $base_installation::params::ldap_cert_path,
+ Optional[String] $ldap_cn = $base_installation::params::ldap_cn,
+ Optional[String] $ldap_dn = $base_installation::params::ldap_dn,
+ Optional[String] $ldap_server = $base_installation::params::ldap_server,
+ Optional[String] $ldap_uri = $base_installation::params::ldap_uri,
+ Optional[String] $puppet_code_path = $base_installation::params::puppet_code_path,
+ Optional[String] $puppet_conf_path = $base_installation::params::puppet_conf_path,
+ Optional[String] $puppet_notifies_path = $base_installation::params::puppet_notifies_path,
+ Optional[String] $puppet_pass_seed = $base_installation::params::puppet_pass_seed,
+ Optional[String] $puppet_ssl_path = $base_installation::params::puppet_ssl_path,
+ Optional[String] $real_hostname = $base_installation::params::real_hostname,
+ Optional[String] $system_hostname = $base_installation::params::system_hostname,
+ Optional[Array[String]] $system_locales = $base_installation::params::system_locales,
+ Optional[String] $system_timezone = $base_installation::params::system_timezone,
+ Optional[Array[Hash]] $system_users = $base_installation::params::system_users,
) inherits base_installation::params {
contain ::base_installation::packages
contain ::base_installation::locales
class base_installation::params {
- $puppet_code_path = "/etc/puppetlabs/code"
- $puppet_conf_path = "/etc/puppetlabs/puppet"
- $puppet_pass_seed = "/etc/puppetlabs/puppet/password_seed"
- $puppet_ssl_path = "/etc/puppetlabs/ssl"
- $grub_device = "/dev/sda"
- $ldap_base = "dc=example,dc=com"
- $ldap_cn = "node"
- $ldap_dn = "cn=node,ou=hosts,dc=example,dc=com"
- $ldap_cert_path = "/etc/ssl/certs/ca-certificates.crt"
- $ldap_uri = "ldaps://ldap.example.com"
- $ldap_server = "ldap.example.com"
- $real_hostname = "example.com"
- $system_hostname = "example.com"
- $system_locales = ["en_US.UTF-8"]
- $system_timezone = "UTC"
- $system_users = [
+ $puppet_code_path = "/etc/puppetlabs/code"
+ $puppet_conf_path = "/etc/puppetlabs/puppet"
+ $puppet_notifies_path = "/etc/puppetlabs/notifies"
+ $puppet_pass_seed = "/etc/puppetlabs/puppet/password_seed"
+ $puppet_ssl_path = "/etc/puppetlabs/ssl"
+ $grub_device = "/dev/sda"
+ $ldap_base = "dc=example,dc=com"
+ $ldap_cn = "node"
+ $ldap_dn = "cn=node,ou=hosts,dc=example,dc=com"
+ $ldap_cert_path = "/etc/ssl/certs/ca-certificates.crt"
+ $ldap_uri = "ldaps://ldap.example.com"
+ $ldap_server = "ldap.example.com"
+ $real_hostname = "example.com"
+ $system_hostname = "example.com"
+ $system_locales = ["en_US.UTF-8"]
+ $system_timezone = "UTC"
+ $system_users = [
{
userid => 1000,
username => "example",
}
}
- if file("$base_installation::puppet_conf_path/host_ldap.info", "/dev/null") != "" and
+ if file("$base_installation::puppet_notifies_path/host_ldap.info", "/dev/null") != "" and
empty($facts["ldapvar"]) {
fail("LDAP was activated but facts are not available")
}
+ file { $base_installation::puppet_notifies_path:
+ ensure => directory,
+ require => [Package["puppet"], Package["gem:xmpp4r"], Package["gem:ruby-ldap"]],
+ recurse => true,
+ purge => true,
+ force => true,
+ }
+
$ips = lookup("ips", { 'default_value' => undef })
- concat { "$base_installation::puppet_conf_path/host_ldap.info":
+ concat { "$base_installation::puppet_notifies_path/host_ldap.info":
ensure => "present",
mode => "0600",
- require => File[$base_installation::puppet_conf_path],
- notify => Notify_refresh["notify-ldap-password"],
+ require => File[$base_installation::puppet_notifies_path],
ensure_newline => true,
}
concat::fragment { "host_ldap add top":
- target => "$base_installation::puppet_conf_path/host_ldap.info",
+ target => "$base_installation::puppet_notifies_path/host_ldap.info",
content => template("base_installation/puppet/host_ldap_add_top.info.erb"),
order => "00-01",
}
concat::fragment { "host_ldap add bottom":
- target => "$base_installation::puppet_conf_path/host_ldap.info",
+ target => "$base_installation::puppet_notifies_path/host_ldap.info",
content => "EOF",
order => "00-99",
}
concat::fragment { "host_ldap mod top":
- target => "$base_installation::puppet_conf_path/host_ldap.info",
+ target => "$base_installation::puppet_notifies_path/host_ldap.info",
content => template("base_installation/puppet/host_ldap_mod_top.info.erb"),
order => "01-01",
}
concat::fragment { "host_ldap mod bottom":
- target => "$base_installation::puppet_conf_path/host_ldap.info",
+ target => "$base_installation::puppet_notifies_path/host_ldap.info",
content => "EOF",
order => "01-99",
}
-
- notify_refresh { "notify-ldap-password":
- message => template("base_installation/puppet/host_ldap.info.erb"),
- refreshonly => true
- }
}
}
[main]
<%
- reports = ["store"]
+ reports = ["store", "cat_files"]
if @xmpp.count > 0
reports << "xmpp"
end