aboutsummaryrefslogtreecommitdiff
path: root/ansible/roles/hacluster/tasks/bootstrap.yml
blob: 9d788e3ec3fbcaa839e5cce10d5df43b73ee9b21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
---
- name: Ensure config directories exist
  file:
    path: "{{ node_custom_config }}/{{ item }}"
    mode: "0755"
    state: directory
  delegate_to: localhost
  changed_when: false
  check_mode: false
  run_once: true
  with_items:
    - hacluster-corosync
    - hacluster-pacemaker

- name: Check if Corosync authkey file exists
  stat:
    path: "{{ node_custom_config }}/hacluster-corosync/authkey"
  delegate_to: localhost
  run_once: true
  register: hacluster_corosync_authkey_file

- name: Check if Pacemaker authkey file exists
  stat:
    path: "{{ node_custom_config }}/hacluster-pacemaker/authkey"
  delegate_to: localhost
  run_once: true
  register: hacluster_pacemaker_authkey_file

- name: Generating Corosync authkey file
  command: "dd if=/dev/urandom of={{ node_custom_config }}/hacluster-corosync/authkey bs=4096 count=1"
  delegate_to: localhost
  changed_when: false
  check_mode: false
  run_once: true
  when: not hacluster_corosync_authkey_file.stat.exists

- name: Generating Pacemaker authkey file
  command: "dd if=/dev/urandom of={{ node_custom_config }}/hacluster-pacemaker/authkey bs=4096 count=1"
  delegate_to: localhost
  changed_when: false
  check_mode: false
  run_once: true
  when: not hacluster_pacemaker_authkey_file.stat.exists