kolla-ansible/ansible/roles/hacluster/tasks/config.yml
Gaëtan Trellu 9f578c85e0 Add HAcluster Ansible role
Adds HAcluster Ansible role. This role contains High Availability
clustering solution composed of Corosync, Pacemaker and Pacemaker Remote.

HAcluster is added as a helper role for Masakari which requires it for
its host monitoring, allowing to provide HA to instances on a failed
compute host.

Kolla hacluster images merged in [1].

[1] https://review.opendev.org/#/c/668765/

Change-Id: I91e5c1840ace8f567daf462c4eb3ec1f0c503823
Implements: blueprint ansible-pacemaker-support
Co-Authored-By: Radosław Piliszek <radoslaw.piliszek@gmail.com>
Co-Authored-By: Mark Goddard <mark@stackhpc.com>
2021-04-08 06:39:19 +00:00

97 lines
3.0 KiB
YAML

---
- name: Ensuring config directories exist
become: true
file:
path: "{{ node_config_directory }}/{{ item.key }}"
state: "directory"
owner: "{{ config_owner_user }}"
group: "{{ config_owner_group }}"
mode: "0770"
when:
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ hacluster_services }}"
- name: Copying over config.json files for services
become: true
template:
src: "{{ item.key }}.json.j2"
dest: "{{ node_config_directory }}/{{ item.key }}/config.json"
mode: "0660"
register: config_jsons
when:
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ hacluster_services }}"
notify:
- "Restart {{ item.key }} container"
- name: Copying over corosync.conf into hacluster-corosync
vars:
service: "{{ hacluster_services['hacluster-corosync'] }}"
template:
src: "{{ item }}"
dest: "{{ node_config_directory }}/hacluster-corosync/corosync.conf"
mode: "0660"
become: true
when:
- inventory_hostname in groups[service.group]
- service.enabled | bool
with_first_found:
- "{{ node_custom_config }}/hacluster-corosync/{{ inventory_hostname }}/corosync.conf"
- "{{ node_custom_config }}/hacluster-corosync/corosync.conf"
- "hacluster_corosync.conf.j2"
notify:
- Restart hacluster-corosync container
- name: Copying over Corosync authkey file
vars:
service: "{{ hacluster_services['hacluster-corosync'] }}"
copy:
src: "{{ item }}"
dest: "{{ node_config_directory }}/hacluster-corosync/authkey"
mode: "0600"
become: true
when:
- inventory_hostname in groups[service.group]
- service.enabled | bool
with_first_found:
- "{{ node_custom_config }}/hacluster-corosync/{{ inventory_hostname }}/authkey"
- "{{ node_custom_config }}/hacluster-corosync/authkey"
notify:
- Restart hacluster-corosync container
- name: Copying over Pacemaker authkey file
vars:
service: "{{ hacluster_services['hacluster-pacemaker'] }}"
copy:
src: "{{ item }}"
dest: "{{ node_config_directory }}//hacluster-pacemaker/authkey"
mode: "0600"
become: true
when:
- inventory_hostname in groups[service.group]
- service.enabled | bool
with_first_found:
- "{{ node_custom_config }}/hacluster-pacemaker/{{ inventory_hostname }}/authkey"
- "{{ node_custom_config }}/hacluster-pacemaker/authkey"
notify:
- Restart hacluster-pacemaker container
- name: Copying over Pacemaker authkey file into hacluster-pacemaker-remote
vars:
service: "{{ hacluster_services['hacluster-pacemaker-remote'] }}"
copy:
src: "{{ item }}"
dest: "{{ node_config_directory }}/hacluster-pacemaker-remote/authkey"
mode: "0600"
become: true
when:
- inventory_hostname in groups[service.group]
- service.enabled | bool
with_first_found:
- "{{ node_custom_config }}/hacluster-pacemaker/{{ inventory_hostname }}/authkey"
- "{{ node_custom_config }}/hacluster-pacemaker/authkey"
notify:
- Restart hacluster-pacemaker-remote container