# Pacemarker config

**URL:** <https://forum.ansible.com/t/pacemarker-config/13218>\
**Category:** Ansible Project\
**Created:** [July 30, 2013, 11:39am UTC](https://forum.ansible.com/t/pacemarker-config/13218 "2013-07-30T11:39:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eloy\_Coto\_Pereiro1](https://avatars.discourse-cdn.com/v4/letter/e/71e660/32.png) [@Eloy\_Coto\_Pereiro1](https://forum.ansible.com/u/Eloy_Coto_Pereiro1)\
**Post date:** [July 30, 2013, 11:39am UTC](https://forum.ansible.com/t/pacemarker-config/13218/1 "2013-07-30T11:39:55Z")

</div>

Hi

I want to setup pacemaker to setup my HA. I want to use ansible for all setup, but I don’t know how to use the resources of the live console.

Pacemaker shell example:  
[http://clusterlabs.org/wiki/Debian\_Lenny\_HowTo#Configure\_an\_IP\_resource](http://clusterlabs.org/wiki/Debian_Lenny_HowTo#Configure_an_IP_resource)

Anyone setup any tool like this? Any external module for make this?

Cheers.

---

<div class="post-metadata">

**Author:** ![James\_Martin2](https://avatars.discourse-cdn.com/v4/letter/j/b9e5f3/32.png) [@James\_Martin2](https://forum.ansible.com/u/James_Martin2)\
**Post date:** [July 30, 2013, 3:33pm UTC](https://forum.ansible.com/t/pacemarker-config/13218/2 "2013-07-30T15:33:41Z")

</div>

IIRC, pacemaker lets you dump the configuration to a file. Seems like  
you could just use a template and configure the cluster that way.

- James

---

<div class="post-metadata">

**Author:** ![Guillaume\_Belrose](https://avatars.discourse-cdn.com/v4/letter/g/3d9bf3/32.png) [@Guillaume\_Belrose](https://forum.ansible.com/u/Guillaume_Belrose)\
**Post date:** [July 31, 2013, 12:58pm UTC](https://forum.ansible.com/t/pacemarker-config/13218/3 "2013-07-31T12:58:54Z")

</div>

Hi all,

A while ago I wrote about using Ansible to bootstrap Pacemaker. There is a blog post with some YAML examples at [http://kafecho.blogspot.com/2013/03/using-ansible-for-configuration.html](http://kafecho.blogspot.com/2013/03/using-ansible-for-configuration.html)

In the post, I only describe how to install and configure Pacemaker nodes. Once your Pacemaker cluster is up, you could use the CRM command via the shell to deploy your primitives. I have written shell scripts in the past to do that.

For example, assuming that you want to deploy a primitive for HA Proxy with a floating IP address, you have a file called **haproxy-stack** with the following content:

```auto
primitive haproxy ocf:heartbeat:haproxy params conffile=/etc/haproxy/haproxy.cfg op monitor interval=30s
primitive haproxy-ip ocf:heartbeat:IPaddr2 params ip="10.162.20.107" cidr_netmask="24" op monitor interval="2s"
group haproxy-stack haproxy-ip haproxy

```

Send that file to the cluster nodes, then from a node within your cluster, run (via the shell) the crm command to update the cluster configuration with the content of the file:

crm configure load update haproxy-stack

You can use Ansible to template and push the file to the Pacemaker nodes, and use the shell module to load the snippet into the crm. I have not tried that last step but it should work.

I hope this helps.

Guillaume.

---

<div class="post-metadata">

**Author:** ![Eloy\_Coto\_Pereiro1](https://avatars.discourse-cdn.com/v4/letter/e/71e660/32.png) [@Eloy\_Coto\_Pereiro1](https://forum.ansible.com/u/Eloy_Coto_Pereiro1)\
**Post date:** [August 1, 2013, 8:32am UTC](https://forum.ansible.com/t/pacemarker-config/13218/4 "2013-08-01T08:32:08Z")

</div>

Hi

Lovely, yesterday finally generate the crm configure in file and make update command and works fine now, my task is like this:

- name: Deploy config to the server  
template: src=crm\_configure.j2 dest=/tmp/crm\_configure mode=0444  
tags:

- config

- corosync

- name: Load config from corosync  
shell: crm configure load update /tmp/crm\_configure  
tags:

- config

- corosync

Many thanks

---

<div class="post-metadata">

**Author:** ![Guillaume\_Belrose](https://avatars.discourse-cdn.com/v4/letter/g/3d9bf3/32.png) [@Guillaume\_Belrose](https://forum.ansible.com/u/Guillaume_Belrose)\
**Post date:** [August 1, 2013, 8:48am UTC](https://forum.ansible.com/t/pacemarker-config/13218/5 "2013-08-01T08:48:12Z")

</div>

I am glad that it worked.  
Guillaume.

---

<div class="post-metadata">

**Author:** ![Vijay\_atluri](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/vijay_atluri/32/4768_2.png) [@Vijay\_atluri](https://forum.ansible.com/u/Vijay_atluri)\
**Post date:** [March 3, 2023, 10:29am UTC](https://forum.ansible.com/t/pacemarker-config/13218/6 "2023-03-03T10:29:53Z")

</div>

Hi ELOy

You have develop pacemaker to find the active node and do patchg first inactive mode and bring the server online inactive mode and migrate resources from active to inactive mode and do patch in another server
