|
| 1 | +- name: Enable HighAvailability repository |
| 2 | + command: yum-config-manager --enable HighAvailability |
| 3 | + changed_when: false |
| 4 | + when: |
| 5 | + - ansible_os_family | lower == 'redhat' |
| 6 | + - ansible_distribution_major_version is version('8', '=') |
| 7 | + |
1 | 8 | - name: Installs pacemaker & corosync |
2 | | - apt: pkg={{item}} state=present |
| 9 | + package: |
| 10 | + name: "{{ item }}" |
| 11 | + state: present |
3 | 12 | with_items: |
4 | 13 | - corosync |
5 | 14 | - pacemaker |
6 | 15 |
|
7 | 16 | - name: Install haveged |
8 | | - apt: pkg=haveged state=present |
9 | | - when: haveged_enabled | default(true) |
| 17 | + package: |
| 18 | + name: haveged |
| 19 | + state: present |
| 20 | + when: haveged_enabled | default(True) | bool |
10 | 21 |
|
11 | 22 | - name: Generates corosync key |
12 | 23 | become: true |
|
19 | 30 | notify: Restart corosync |
20 | 31 |
|
21 | 32 | - name: Generate tmpdir for authkey |
22 | | - local_action: tempfile |
| 33 | + local_action: |
| 34 | + module: tempfile |
23 | 35 | register: authkey_tempfile |
24 | 36 | changed_when: False |
25 | 37 | check_mode: no |
26 | 38 | when: inventory_hostname != groups[pacemaker_corosync_group][0] |
27 | 39 |
|
28 | 40 | - name: Fetch authkey for other nodes |
29 | | - fetch: src=/etc/corosync/authkey dest="{{ authkey_tempfile.path }}" flat=yes |
| 41 | + fetch: |
| 42 | + src: /etc/corosync/authkey |
| 43 | + dest: "{{ authkey_tempfile.path }}" |
| 44 | + flat: yes |
30 | 45 | delegate_to: "{{ groups[pacemaker_corosync_group][0] }}" |
31 | 46 | changed_when: False |
32 | 47 | check_mode: no |
33 | 48 | when: inventory_hostname != groups[pacemaker_corosync_group][0] |
34 | 49 |
|
35 | 50 | - name: Copy authkey to other nodes |
36 | | - copy: src="{{ authkey_tempfile.path }}" dest=/etc/corosync/authkey mode=0400 |
| 51 | + copy: |
| 52 | + src: "{{ authkey_tempfile.path }}" |
| 53 | + dest: /etc/corosync/authkey |
| 54 | + mode: "0400" |
37 | 55 | when: inventory_hostname != groups[pacemaker_corosync_group][0] |
38 | 56 | notify: Restart corosync |
39 | 57 |
|
|
49 | 67 | - name: Chowns authkeys |
50 | 68 | file: |
51 | 69 | path: /etc/corosync/authkey |
52 | | - mode: 0400 |
| 70 | + mode: "0400" |
53 | 71 | owner: root |
54 | 72 | notify: Restart corosync |
55 | 73 |
|
56 | 74 | - name: Creates corosync config |
57 | 75 | template: |
58 | 76 | src: corosync.conf.j2 |
59 | 77 | dest: /etc/corosync/corosync.conf |
60 | | - mode: 0400 |
| 78 | + mode: "0400" |
61 | 79 | owner: root |
62 | 80 | notify: Restart corosync |
63 | 81 |
|
64 | 82 | - name: Adds logrotate config for corosync |
65 | 83 | template: |
66 | 84 | src: corosync_logrotate.conf.j2 |
67 | 85 | dest: /etc/logrotate.d/corosync |
68 | | - mode: 0644 |
| 86 | + mode: "0644" |
69 | 87 | owner: root |
70 | 88 |
|
71 | 89 | - name: Creates services directory |
|
78 | 96 | src: pcmk |
79 | 97 | dest: /etc/corosync/service.d/pcmk |
80 | 98 | owner: root |
81 | | - mode: 0400 |
| 99 | + mode: "0400" |
82 | 100 | notify: Restart corosync |
83 | 101 |
|
84 | 102 | - name: Adds ferm filtering |
|
88 | 106 | when: ferm_enabled | default(false) |
89 | 107 | tags: ferm |
90 | 108 | notify: Restart ferm |
91 | | - |
92 | | -- name: Enables corosync at boot |
93 | | - copy: |
94 | | - dest: /etc/default/corosync |
95 | | - content: "START=yes" |
96 | | - when: ansible_service_mgr != "systemd" |
97 | | - |
98 | | -- name: Enables corosync at boot |
99 | | - systemd: name=corosync.service state=started enabled=yes |
100 | | - when: ansible_service_mgr == "systemd" |
101 | | - |
102 | | -- name: Registers pacemaker service |
103 | | - service: |
104 | | - name: pacemaker |
105 | | - enabled: true |
106 | | - |
|
0 commit comments