# SPDX-License-Identifier: MIT
---
- name: Get corosync authkey
  ansible.builtin.include_tasks: ../presharedkey.yml
  vars:
    preshared_key_label: corosync authkey
    preshared_key_src: "{{ ha_cluster_corosync_key_src }}"
    preshared_key_dest: /etc/corosync/authkey
    preshared_key_length: 256

- name: Distribute corosync authkey
  ansible.builtin.copy:
    content: "{{ __ha_cluster_some_preshared_key | b64decode }}"
    dest: /etc/corosync/authkey
    owner: root
    group: root
    mode: '0400'
  register: __ha_cluster_distribute_corosync_authkey
  no_log: true

- name: Get pacemaker authkey
  ansible.builtin.include_tasks: ../presharedkey.yml
  vars:
    preshared_key_label: pacemaker authkey
    preshared_key_src: "{{ ha_cluster_pacemaker_key_src }}"
    preshared_key_dest: /etc/pacemaker/authkey
    preshared_key_length: 256

- name: Distribute pacemaker authkey
  ansible.builtin.copy:
    content: "{{ __ha_cluster_some_preshared_key | b64decode }}"
    dest: /etc/pacemaker/authkey
    owner: hacluster
    group: haclient
    mode: '0400'
  register: __ha_cluster_distribute_pacemaker_authkey
  no_log: true
