Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Some cleaning up and writing README

  • Loading branch information...
commit 37a63d4e9b0e1ab17497b27523cb44539afc6209 1 parent db68a77
Lars Fronius authored
View
31 README
@@ -0,0 +1,31 @@
+This is a module to manage pacemaker-clusters and services from within puppet.
+
+== Setup the cluster and services ==
+
+== Add module for service ==
+
+If you want to set-up a service, you will want to add a pacemaker::service::servicename class.
+Best choice to do this, is the modules/pacemaker/manifests/services/ directory.
+The service definition should have a parameter for the cluster-name and it should include the pacemaker::service class in the following manner:
+
+class pacemaker::service::foobar ( $clustername = 'default' ) {
+ pacemaker::service { "foobar":
+ clustername => $clustername,
+ servicename => 'foobar',
+ require => [Package["foobar","foobaz"]]
+ }
+(...)
+
+The require should include all the packages and file you are using within the pacemaker::service::servicename class.
+
+== Add cluster ==
+
+A cluster consists of three files. The configuration of the cluster messaging (corosync.conf),
+an authentication key for the encrypted and authenticated communication within the cluster (authkey)
+and some general configuration of your cluster like quorum configuration. (crm.cib)
+
+All of these files should come into a directory within the files directory called cluster-clustername. That's it.
+
+You can include them by setting the $clustername in the pacemaker::service::servicename class to your directories clustername.
+
+That's it.
View
2  TODO
@@ -1,3 +1,3 @@
README :)
-slapd as seperate file, class or module?!
write skeleton
+Fix the lines that are quoted right now, because they are not stable...
View
1  Vagrantfile
@@ -4,6 +4,7 @@ Vagrant::Config.run do |config|
puppet.manifests_path = "manifests"
puppet.manifest_file = "site.pp"
puppet.module_path = "modules"
+# puppet.options = "--verbose --debug"
end
config.vm.define :host01 do |config|
View
5 manifests/nodes.pp
@@ -5,6 +5,7 @@
}
node /^host0([2-9])/ {
- include skeleton
+ class { 'pacemaker::service::slapd':
+ clustername => 'default'
+ }
}
-
View
4 manifests/site.pp
@@ -4,9 +4,7 @@
Exec["apt-get-update"] -> Package <| |>
-Exec {
- path => "/usr/bin:/usr/sbin:/bin"
-}
+Exec { path => [ "/bin/", "/sbin/" , "/usr/bin/", "/usr/sbin/" ] }
exec { "apt-get-update" :
command => "/usr/bin/apt-get update",
View
31 modules/pacemaker/manifests/init.pp
@@ -21,10 +21,12 @@
}
exec { "reload cluster config":
command => "crm -F configure load update /etc/ha.d/crm.cib && test $(cat /etc/ha.d/crm.cib | wc -l) -eq $(crm configure show | sed 's/^ *//' | grep -c -F -f /etc/ha.d/crm.cib)",
+# command => 'crm -F configure load update /etc/ha.d/crm.cib && test "$( cat /etc/ha.d/crm.cib | sed \'s/^[\t ]*//\' )" = "$( crm configure show | sed \'s/^[\t ]*//\' | grep -F -f <( cat /etc/ha.d/crm.cib | sed \'s/^[\t ]*//\' ) )"',
refreshonly => true,
require => [Service["corosync"],File["/etc/ha.d/crm.cib"]],
subscribe => File["/etc/ha.d/crm.cib"],
unless => "test $(cat /etc/ha.d/crm.cib | wc -l) -eq $(crm configure show | 's/^ *//' | grep -c -F -f /etc/ha.d/crm.cib)",
+# unless => 'test "$( cat /etc/ha.d/crm.cib | sed \'s/^[\t ]*//\' )" = "$( crm configure show | sed \'s/^[\t ]*//\' | grep -F -f <( cat /etc/ha.d/crm.cib | sed \'s/^[\t ]*//\' ) )"',
tries => 10,
try_sleep => 20,
}
@@ -40,12 +42,14 @@
$cibfile = "/etc/ha.d/$servicename.cib"
exec { "reload service config":
command => "crm -F configure load update $cibfile && test $(cat $cibfile | wc -l) -eq $(crm configure show | sed 's/^ *//' | grep -c -F -f $cibfile)",
+# command => "crm -F configure load update $cibfile && test \"$( cat $cibfile | sed 's/^[\t ]*//' )\" = \"$( crm configure show | sed 's/^[\t ]*//' | grep -F -f <( cat $cibfile | sed 's/^[\t ]*//' ) )\"",
refreshonly => true,
subscribe => File["cib-file"],
unless => "test $(cat $cibfile | wc -l) -eq $(crm configure show | sed 's/^ *//' |grep -c -F -f $cibfile)",
+# unless => "test \"$( cat $cibfile | sed 's/^[\t ]*//' )\" = \"$( crm configure show | sed 's/^[\t ]*//' | grep -F -f <( cat $cibfile | sed 's/^[\t ]*//' ) )\"",
tries => 20,
try_sleep => 6,
- require => [Service["corosync"],Configfile["cib-file"]],
+ require => [Service["corosync"],Configfile["cib-file"],Exec["reload cluster config"]]
}
configfile { "cib-file":
path => "$cibfile",
@@ -53,26 +57,5 @@
source => "modules/pacemaker/$servicename.cib",
}
}
-class pacemaker::service::slapd {
- pacemaker::service { "slapd":
- clustername => 'default',
- servicename => 'slapd',
- require => [Package["slapd","ldap-utils"],File["/usr/lib/ocf/resource.d/heartbeat/slapd"]]
- }
- package { ["slapd","ldap-utils"]:
- ensure => present,
- }
- service { ["slapd"]:
- ensure => stopped,
- enable => false,
- require => Package["slapd"],
- }
- file { "/usr/lib/ocf/resource.d/heartbeat/slapd":
- source => "modules/pacemaker/slapd",
- ensure => present,
- mode => 755,
- owner => root,
- group => root,
- require => Package['pacemaker'],
- }
-}
+
+import "services/*.pp"
View
24 modules/pacemaker/manifests/services/slapd.pp
@@ -0,0 +1,24 @@
+class pacemaker::service::slapd ( $clustername = 'default' ) {
+ pacemaker::service { "slapd":
+ clustername => $clustername,
+ servicename => 'slapd',
+ require => [Package["slapd","ldap-utils"],File["/usr/lib/ocf/resource.d/heartbeat/slapd"]]
+ }
+ package { ["slapd","ldap-utils"]:
+ ensure => present,
+ }
+ service { ["slapd"]:
+ ensure => stopped,
+ enable => false,
+ subscribe => Package["slapd"],
+ require => Package["slapd"],
+ }
+ file { "/usr/lib/ocf/resource.d/heartbeat/slapd":
+ source => "modules/pacemaker/slapd",
+ ensure => present,
+ mode => 755,
+ owner => root,
+ group => root,
+ require => Package['pacemaker'],
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.