Is it possible to configure pacemaker with a configuration file

corosyncpacemaker

I'm trying to configure pacemaker with a config file (that I can automatically generate and then ask pacemaker to "reload"). But all the examples that I see are for command-line commands or the interactive editor. (I'm running Ubuntu).

The command-line approach is something like this:

crm configure primitive VIP ocf:IPaddr2 params ip=10.0.2.200 nic=eth0 op monitor interval=10s

While the interactive mode is something like this:

sudo crm configure
And then we add the res_ip resource:

crm(live)configure# primitive res_ip ocf:heartbeat:IPaddr2 params ip="102.169.122.254" cidr_netmask="24" nic="eth0"
crm(live)configure# commit
crm(live)configure# exit

But I want a static config file that I can update and reload. Something like the /etc/ha.d/haresources file that heartbeat uses. Is that a possibility?

Best Answer

Definitely. Create a configuration file (named 'cib.txt', in our example) with the same syntax you've used in your example commands:

primitive VIP ocf:heartbeat:IPaddr2 params ip=10.0.2.200 nic=eth0 \
    op monitor interval=10s timeout=20s \
    op start interval=0 timeout=20s \
    op stop interval=0 timeout=20s

Then you can load that file using the following CRM shell command:

# crm configure load update cib.txt

or completely replace the configuration:

# crm configure load replace cib.txt

NOTE: You can export the configuration from a cluster, for use on a new cluster or for backup purposes, with the following command:

# crm configure show > cib.txt

WARN: Be sure to cut out anything specific to the original cluster if you intend to load it elsewhere (node id's, dc-version, last-lrm-refresh, etc).