Merge "Reimplement external LB management handler hook"

This commit is contained in:
Jenkins 2017-09-14 20:26:14 +00:00 committed by Gerrit Code Review
commit f740c0e9db
5 changed files with 23 additions and 8 deletions

View File

@ -187,9 +187,6 @@ galera_ssl_address: "{{ ansible_host }}"
# setting in the systemd unit file for MariaDB on CentOS 7 hosts.
galera_disable_privatedevices: no
# Allow the playbook to orchestrate service restart handlers
galera_external_restart_handlers: no
## Set default mirror for openSUSE repositories
# NOTE(hwoarang): Ensure that the full path to the 'opensuse' directory is used.
#galera_server_opensuse_mirror_obs_url: "http://widehat.opensuse.org"

View File

@ -29,3 +29,16 @@ Example playbook
.. literalinclude:: ../../examples/playbook.yml
:language: yaml
External Restart Hooks
~~~~~~~~~~~~~~~~~~~~~~
When the role performs a restart of the mariadb service, it will notify an
Ansible handler named ``Manage LB``, which is a noop within this role. In the
playbook, other roles may be loaded before and after this role which will
implement Ansible handler listeners for ``Manage LB``, that way external roles
can manage the load balancer endpoints responsible for sending traffic to the
MariaDB servers being restarted by marking them in maintenance or active mode,
draining sessions, etc. For an example implementation, please reference the
`ansible-haproxy-endpoints role <https://github.com/Logan2211/ansible-haproxy-endpoints>`_
used by the openstack-ansible project.

View File

@ -29,7 +29,6 @@
when:
- not galera_running_and_bootstrapped | bool
- ansible_pkg_mgr != "zypper"
- not galera_external_restart_handlers | bool
register: galera_restart
until: galera_restart | success
retries: 3
@ -71,7 +70,6 @@
- not galera_running_and_bootstrapped | bool
- not galera_existing_cluster | bool and inventory_hostname == galera_server_bootstrap_node
- ansible_pkg_mgr == "zypper"
- not galera_external_restart_handlers | bool
- name: "Ensure node is not in bootstrap mode"
lineinfile:
@ -83,7 +81,6 @@
- not galera_running_and_bootstrapped | bool
- (not galera_existing_cluster | bool) or (not inventory_hostname == galera_server_bootstrap_node)
- ansible_pkg_mgr == "zypper"
- not galera_external_restart_handlers | bool
- name: Restart mysql on SUSE
service:
@ -92,7 +89,6 @@
when:
- not galera_running_and_bootstrapped | bool
- ansible_pkg_mgr == "zypper"
- not galera_external_restart_handlers | bool
register: galera_restart
until: galera_restart | success
retries: 3
@ -103,3 +99,7 @@
notify:
- "Remove stale .sst"
listen: "Restart all mysql"
- meta: noop
listen: Manage LB
when: false

View File

@ -125,6 +125,7 @@
- ansible_pkg_mgr in ['yum', 'dnf']
- systemd_mysql_service.stat.exists
notify:
- Manage LB
- Reload the systemd daemon
- Restart mysql
tags:

View File

@ -78,7 +78,9 @@
dest: /etc/mysql/debian.cnf
config_overrides: "{{ galera_debian_cnf_overrides }}"
config_type: "ini"
notify: Restart all mysql
notify:
- Manage LB
- Restart all mysql
tags:
- galera-config
- galera-client-user-config
@ -103,6 +105,7 @@
mode: "0644"
when: ansible_pkg_mgr != 'zypper'
notify:
- Manage LB
- Restart all mysql
- Reload the systemd daemon
tags:
@ -130,6 +133,7 @@
when:
- ansible_service_mgr == 'systemd'
notify:
- Manage LB
- Reload the systemd daemon
- Restart all mysql
tags: