kolla-ansible/ansible/rabbitmq.yml
Mark Goddard af6e1ca4fd Support Ansible max_fail_percentage
This allows us to continue execution until a certain proportion of hosts
to fail. This can be useful at scale, where failures are common, and
restarting a deployment is time-consuming.

The default max failure percentage is 100, keeping the default
behaviour. A global max failure percentage may be set via
kolla_max_fail_percentage, and individual services may define a max
failure percentage via <service>_max_fail_percentage.

Note that all hosts in the inventory must be reachable for fact
gathering, even those not included in a --limit.

Closes-Bug: #1833737
Change-Id: I808474a75c0f0e8b539dc0421374b06cea44be4f
2023-12-05 11:49:42 +01:00

140 lines
4.3 KiB
YAML

---
# For RabbitMQ we need to be careful about restarting services, to avoid losing quorum.
- name: Apply role rabbitmq
gather_facts: false
hosts:
- rabbitmq
- '&enable_rabbitmq_True'
max_fail_percentage: >-
{{ rabbitmq_max_fail_percentage |
default(kolla_max_fail_percentage) |
default(100) }}
tags:
- rabbitmq
tasks:
- import_role:
name: rabbitmq
vars:
role_rabbitmq_cluster_cookie: '{{ rabbitmq_cluster_cookie }}'
role_rabbitmq_cluster_port: '{{ rabbitmq_cluster_port }}'
role_rabbitmq_epmd_port: '{{ rabbitmq_epmd_port }}'
role_rabbitmq_groups: rabbitmq
role_rabbitmq_management_port: '{{ rabbitmq_management_port }}'
role_rabbitmq_monitoring_password: '{{ rabbitmq_monitoring_password }}'
role_rabbitmq_monitoring_user: '{{ rabbitmq_monitoring_user }}'
role_rabbitmq_password: '{{ rabbitmq_password }}'
role_rabbitmq_port: '{{ rabbitmq_port }}'
role_rabbitmq_prometheus_port: '{{ rabbitmq_prometheus_port }}'
role_rabbitmq_user: '{{ rabbitmq_user }}'
- name: Restart rabbitmq services
gather_facts: false
hosts:
- rabbitmq_restart
- '&enable_rabbitmq_True'
# Restart in batches
serial: "33%"
max_fail_percentage: >-
{{ rabbitmq_max_fail_percentage |
default(kolla_max_fail_percentage) |
default(100) }}
tags:
- rabbitmq
tasks:
- import_role:
name: rabbitmq
tasks_from: restart_services.yml
vars:
role_rabbitmq_cluster_cookie: '{{ rabbitmq_cluster_cookie }}'
role_rabbitmq_groups: rabbitmq
- name: Apply rabbitmq post-configuration
gather_facts: false
hosts:
- rabbitmq
- '&enable_rabbitmq_True'
max_fail_percentage: >-
{{ rabbitmq_max_fail_percentage |
default(kolla_max_fail_percentage) |
default(100) }}
tags:
- rabbitmq
tasks:
- name: Include rabbitmq post-deploy.yml
include_role:
name: rabbitmq
tasks_from: post-deploy.yml
when: kolla_action in ['deploy', 'reconfigure']
vars:
role_rabbitmq_cluster_cookie: '{{ rabbitmq_cluster_cookie }}'
role_rabbitmq_groups: rabbitmq
- name: Apply role rabbitmq (outward)
gather_facts: false
hosts:
- outward-rabbitmq
- '&enable_outward_rabbitmq_True'
max_fail_percentage: >-
{{ rabbitmq_max_fail_percentage |
default(kolla_max_fail_percentage) |
default(100) }}
tags:
- rabbitmq
tasks:
- import_role:
name: rabbitmq
vars:
project_name: outward_rabbitmq
role_rabbitmq_cluster_cookie: '{{ outward_rabbitmq_cluster_cookie }}'
role_rabbitmq_cluster_port: '{{ outward_rabbitmq_cluster_port }}'
role_rabbitmq_epmd_port: '{{ outward_rabbitmq_epmd_port }}'
role_rabbitmq_groups: outward-rabbitmq
role_rabbitmq_management_port: '{{ outward_rabbitmq_management_port }}'
role_rabbitmq_password: '{{ outward_rabbitmq_password }}'
role_rabbitmq_port: '{{ outward_rabbitmq_port }}'
role_rabbitmq_prometheus_port: '{{ outward_rabbitmq_prometheus_port }}'
role_rabbitmq_user: '{{ outward_rabbitmq_user }}'
- name: Restart rabbitmq (outward) services
gather_facts: false
hosts:
- outward_rabbitmq_restart
- '&enable_outward_rabbitmq_True'
# Restart in batches
serial: "33%"
max_fail_percentage: >-
{{ rabbitmq_max_fail_percentage |
default(kolla_max_fail_percentage) |
default(100) }}
tags:
- rabbitmq
tasks:
- import_role:
name: rabbitmq
tasks_from: restart_services.yml
vars:
project_name: outward_rabbitmq
role_rabbitmq_cluster_cookie: '{{ outward_rabbitmq_cluster_cookie }}'
role_rabbitmq_groups: outward-rabbitmq
- name: Apply rabbitmq (outward) post-configuration
gather_facts: false
hosts:
- outward-rabbitmq
- '&enable_outward_rabbitmq_True'
max_fail_percentage: >-
{{ rabbitmq_max_fail_percentage |
default(kolla_max_fail_percentage) |
default(100) }}
tags:
- rabbitmq
tasks:
- name: Include rabbitmq (outward) post-deploy.yml
include_role:
name: rabbitmq
when: kolla_action in ['deploy', 'reconfigure']
vars:
project_name: outward_rabbitmq
role_rabbitmq_cluster_cookie: '{{ outward_rabbitmq_cluster_cookie }}'
role_rabbitmq_groups: outward-rabbitmq