Created
March 6, 2013 13:48
-
-
Save kafecho/5099412 to your computer and use it in GitHub Desktop.
Revisions
-
kafecho created this gist
Mar 6, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ # This playbook installs and configure corosync and pacemaker on a set of nodes part of a given group. --- # See the file /etc/ansible/hosts where the group is actually defined. There might be a way to define groups in a file 'closer' to this playbook. - hosts: clusternodes vars: mcastport : 5405 tasks: # It would be better to use Ansible to change the IP tables config to allow corosync/pacemaker on the nodes part of the cluster. - name: ensure iptables is stopped and is not running at boot time. action: service name=iptables state=stopped enabled=no - name: ensure python-selinux is installed on all nodes. action: yum name=libselinux-python state=installed - name: set SELinux to permissive action: selinux policy=targeted state=permissive - name: ensure SELinux is turned off action: command /usr/sbin/setenforce 0 - name: ensure corosync is installed. action: yum name=corosync state=installed - name: write the corosync config files action: template src=corosync.conf dest=/etc/corosync/corosync.conf - name: add the pcmk file in the folder service.d for corosync configuration action: copy src=pcmk dest=/etc/corosync/service.d/pcmk - name: ensure Pacemaker is installed. action: yum name=pacemaker state=installed - name: ensure corosync is running (and automatically at boot time) action: service name=corosync state=started enabled=yes - name: ensure pacemaker is running automatically at boot time action: command /sbin/chkconfig pacemaker on - name: ensure Pacemaker is running (and also enabled to start at boot time). For some reason, Pacemaker will fail to start when the steps below are done synchronously. action: service name=pacemaker state=started enabled=yes async: 60 poll: 5 This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ # Please read the corosync.conf.5 manual page compatibility: whitetank totem { version: 2 secauth: off interface { {% for host in hostvars %} member { memberaddr: {{ hostvars[host]['ansible_eth1']['ipv4']['address']}} } {% endfor %} ringnumber: 0 bindnetaddr: {{ bindnetaddr }} mcastport: {{ mcastport }} ttl: 1 } transport: udpu } logging { fileline: off to_logfile: yes to_syslog: yes debug: on logfile: /var/log/corosync.log debug: off timestamp: on logger_subsys { subsys: AMF debug: off } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ service{ name: pacemaker ver: 1 }