|
| 1 | +- name: Installs pacemaker & corosync |
| 2 | + apt: pkg={{item}} state=latest |
| 3 | + with_items: |
| 4 | + - corosync |
| 5 | + - pacemaker |
| 6 | + - haveged |
| 7 | + |
| 8 | +- name: Generates corosync key |
| 9 | + become: true |
| 10 | + become_user: root |
| 11 | + command: corosync-keygen |
| 12 | + args: |
| 13 | + creates: /etc/corosync/authkey |
| 14 | + when: inventory_hostname == groups[pacemaker_corosync_group][0] |
| 15 | + register: __corosync_authkey_created |
| 16 | + notify: Restart corosync |
| 17 | + |
| 18 | +- name: Copy authkey to other nodes |
| 19 | + synchronize: src=/etc/corosync/authkey dest=/etc/corosync/authkey |
| 20 | + delegate_to: "{{ groups[pacemaker_corosync_group][0] }}" |
| 21 | + when: inventory_hostname != groups[pacemaker_corosync_group][0] |
| 22 | + notify: Restart corosync |
| 23 | + |
| 24 | +- name: Chowns authkeys |
| 25 | + file: |
| 26 | + path: /etc/corosync/authkey |
| 27 | + mode: 0400 |
| 28 | + owner: root |
| 29 | + notify: Restart corosync |
| 30 | + |
| 31 | +- name: Creates corosync config |
| 32 | + template: |
| 33 | + src: corosync.conf.j2 |
| 34 | + dest: /etc/corosync/corosync.conf |
| 35 | + mode: 0400 |
| 36 | + owner: root |
| 37 | + notify: Restart corosync |
| 38 | + |
| 39 | +- name: Adds logrotate config for corosync |
| 40 | + template: |
| 41 | + src: corosync_logrotate.conf.j2 |
| 42 | + dest: /etc/logrotate.d/corosync |
| 43 | + mode: 0644 |
| 44 | + owner: root |
| 45 | + |
| 46 | +- name: Adds pacemaker service |
| 47 | + copy: |
| 48 | + src: pcmk |
| 49 | + dest: /etc/corosync/service.d/pcmk |
| 50 | + owner: root |
| 51 | + mode: 0400 |
| 52 | + notify: Restart corosync |
| 53 | + |
| 54 | +- name: Adds ferm filtering |
| 55 | + template: |
| 56 | + src: "../templates/ferm.j2" |
| 57 | + dest: /etc/ferm/filter-input.d/60_corosync.conf |
| 58 | + when: ferm_enabled | default(false) |
| 59 | + tags: ferm |
| 60 | + notify: Restart ferm |
| 61 | + |
| 62 | +- name: Enables corosync at boot |
| 63 | + copy: |
| 64 | + dest: /etc/default/corosync |
| 65 | + content: "START=yes" |
| 66 | + |
| 67 | +- name: Registers pacemaker service |
| 68 | + service: |
| 69 | + name: pacemaker |
| 70 | + enabled: true |
| 71 | + |
0 commit comments