[Pacemaker] Help with configuring pacemaker automatically with chef

Robert van Leeuwen vanleeuwen at stone-it.com
Fri Jan 14 05:20:07 EST 2011


> Hi guys,
>   I'm having a hard time finding the info I need to configure pacemaker from an 
> input file.  I've been using Zookeeper a lot in our application tier, so I'm 
> familiar with clusters, however I'm struggling to adapt that knowledge to the 
> pacemaker configuration.
> 
> 
> Now I need to perform the following.
> 
> Only 1 node is running these services at a time, the other two do not have 
> these services running.  I need to check our public IP, which can be configured 
> from chef.
> 
> 
> On Start
> start haproxy
> start stunnel
> execute custom script to switch our amazon ec2 ip to the node running
> 
> on stop
> stop haproxy
> stop stunnel
> 
> 
> 
> Another caveat.  I've read the cluster_from_scratch several times.  It uses the 
> interactive command line to configure pacemaker.  I need to create an xml file 
> directly using my chef recipes.  I have no ability to know each node's UUID, 
> only the hostname.  Can anyone provide me with an example of how I can 
> configure pacemaker from an xml file to execute several scripts?


Todd,

You can configure pacemaker from the commandline in the following way:
crm configure < resource.res 

The resource.res should look like the command's you would enter from crm. 
e.g.:
primitive haproxy lsb:/usr/local/bin/haproxy
primitive stunnel lsb:/usr/local/bin/lsb
primitive amazonip lsb:/usr/local/bin/amazonip
order stunnel-after-haproxy inf: haproxy stunnel
order amazonip-after-stunnel inf: stunnel amazonip
commit 

Regarding you're custom scripts I would create a OCF or LSB compliant script as in the example above.
You can place these in the standard dirs or you could use the full path.
Now you can simply manage these as "standard" resources.

Hope this helps,

Robert van Leeuwen




More information about the Pacemaker mailing list