Pacemarker config

628 views
Skip to first unread message

Eloy Coto Pereiro

unread,
Jul 30, 2013, 7:39:55 AM7/30/13
to ansible...@googlegroups.com
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:

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

Cheers. 

James Martin

unread,
Jul 30, 2013, 11:33:41 AM7/30/13
to ansible...@googlegroups.com
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
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-proje...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Guillaume Belrose

unread,
Jul 31, 2013, 8:58:54 AM7/31/13
to ansible...@googlegroups.com
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

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:

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.

Eloy Coto Pereiro

unread,
Aug 1, 2013, 4:32:08 AM8/1/13
to ansible...@googlegroups.com
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

Guillaume Belrose

unread,
Aug 1, 2013, 4:48:12 AM8/1/13
to ansible...@googlegroups.com
I am glad that it worked.
Guillaume.

You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/W5l6vJYX9L0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.

Vijay atluri

unread,
Mar 3, 2023, 5:29:53 AM3/3/23
to Ansible Project
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 
Reply all
Reply to author
Forward
0 new messages