From 7632df34d45e95e222b8294dbddb52f302985366 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Fri, 3 Jul 2020 00:13:58 +0300 Subject: [PATCH] Add corosync/pacemaker installation Masakari hostmonitors require corosync cluster to be present for their proper work. There's already a role for the deployment, so we can simply make us of it and integrate with masakari playbook. Needed-By: https://review.opendev.org/744673 Change-Id: I24fa44a6c3e8feeb8a7581663b53343b9c881145 --- ansible-role-requirements.yml | 5 +++++ etc/openstack_deploy/conf.d/masakari.yml.aio | 6 +++++- etc/openstack_deploy/conf.d/masakari.yml.example | 11 ++++++++++- inventory/group_vars/masakari-monitor_hosts.yml | 16 ++++++++++++++++ playbooks/os-masakari-install.yml | 12 ++++++++++++ ...sakari-corosync-cluster-2be3f4a1e2a38fe1.yaml | 7 +++++++ scripts/log-collect.sh | 2 ++ tests/test_inventory.py | 1 + 8 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 inventory/group_vars/masakari-monitor_hosts.yml create mode 100644 releasenotes/notes/masakari-corosync-cluster-2be3f4a1e2a38fe1.yaml diff --git a/ansible-role-requirements.yml b/ansible-role-requirements.yml index c6d59ed416..949d90b9bb 100644 --- a/ansible-role-requirements.yml +++ b/ansible-role-requirements.yml @@ -283,6 +283,11 @@ src: https://github.com/logan2211/ansible-haproxy-endpoints version: master trackbranch: master +- name: pacemaker_corosync + scm: git + src: https://github.com/noonedeadpunk/ansible-pacemaker-corosync + trackbranch: master + version: master - name: nspawn_container_create src: https://opendev.org/openstack/openstack-ansible-nspawn_container_create scm: git diff --git a/etc/openstack_deploy/conf.d/masakari.yml.aio b/etc/openstack_deploy/conf.d/masakari.yml.aio index 02eb4b6a40..f7e1bf1c4f 100644 --- a/etc/openstack_deploy/conf.d/masakari.yml.aio +++ b/etc/openstack_deploy/conf.d/masakari.yml.aio @@ -1,4 +1,8 @@ --- masakari-infra_hosts: aio1: - ip: 172.29.236.100 \ No newline at end of file + ip: 172.29.236.100 + +masakari-monitor_hosts: + aio1: + ip: 172.29.236.100 diff --git a/etc/openstack_deploy/conf.d/masakari.yml.example b/etc/openstack_deploy/conf.d/masakari.yml.example index 07d9b04645..f5376f413a 100644 --- a/etc/openstack_deploy/conf.d/masakari.yml.example +++ b/etc/openstack_deploy/conf.d/masakari.yml.example @@ -6,4 +6,13 @@ masakari-infra_hosts: infra2: ip: 172.20.236.112 infra3: - ip: 172.20.236.113 \ No newline at end of file + ip: 172.20.236.113 + +# The infra nodes that will be running the masakari monitors +masakari-monitor_hosts: + infra1: + ip: 172.20.236.111 + infra2: + ip: 172.20.236.112 + infra3: + ip: 172.20.236.113 diff --git a/inventory/group_vars/masakari-monitor_hosts.yml b/inventory/group_vars/masakari-monitor_hosts.yml new file mode 100644 index 0000000000..9e86c80f1c --- /dev/null +++ b/inventory/group_vars/masakari-monitor_hosts.yml @@ -0,0 +1,16 @@ +--- +# Copyright 2020, Dmitriy Rabotyagov +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +masakari_monitor_corosync_multicast_interface: "br-mgmt" diff --git a/playbooks/os-masakari-install.yml b/playbooks/os-masakari-install.yml index 23693ed5c5..39ca829f47 100644 --- a/playbooks/os-masakari-install.yml +++ b/playbooks/os-masakari-install.yml @@ -19,6 +19,18 @@ tags: - always +- name: Setup corosync cluster + hosts: masakari_monitor + gather_facts: false + user: root + vars: + pacemaker_corosync_group: masakari_monitor + pacemaker_corosync_ring_interface: "{{ masakari_monitor_corosync_multicast_interface }}" + haveged_enabled: false + roles: + - role: "pacemaker_corosync" + tags: pacemaker-corosync + - name: Install the masakari components hosts: masakari_all gather_facts: false diff --git a/releasenotes/notes/masakari-corosync-cluster-2be3f4a1e2a38fe1.yaml b/releasenotes/notes/masakari-corosync-cluster-2be3f4a1e2a38fe1.yaml new file mode 100644 index 0000000000..09ffea465b --- /dev/null +++ b/releasenotes/notes/masakari-corosync-cluster-2be3f4a1e2a38fe1.yaml @@ -0,0 +1,7 @@ +--- +features: + - | + OpenStack-Ansible now provided corosync and pacemaker cluster setup as part + of the os-masakari-install playbook. Corosync/pacemaker cluster is required + for the proper work of masakari hostmonitors, as they identify hosts state + with help of corosync. diff --git a/scripts/log-collect.sh b/scripts/log-collect.sh index 9a634849c7..53296c77ca 100755 --- a/scripts/log-collect.sh +++ b/scripts/log-collect.sh @@ -40,6 +40,7 @@ COMMON_ETC_LOG_NAMES="apt \ apache2 \ auditd \ calico \ + corosync \ ceph \ etcd \ ganesha \ @@ -53,6 +54,7 @@ COMMON_ETC_LOG_NAMES="apt \ network \ nginx \ openstack_deploy \ + pacemaker \ pip.conf \ qpid-dispatch \ rabbitmq \ diff --git a/tests/test_inventory.py b/tests/test_inventory.py index 77b6722816..8136a13375 100644 --- a/tests/test_inventory.py +++ b/tests/test_inventory.py @@ -312,6 +312,7 @@ class TestAnsibleInventoryFormatConstraints(unittest.TestCase): 'masakari-infra_containers', 'masakari-infra_hosts', 'masakari_monitor', + 'masakari-monitor_all', 'masakari-monitor_containers', 'masakari_monitors_container', 'masakari-monitor_hosts',