Add external LB management handler hook interface
Based on conversation on an ansible issue[1], I implemented a LB orchestration role[2] similar to the POC here[3]. This will allow external loadbalancer management roles to hook into a universal notify listener "Manage LB" to perform before/ after endpoint management actions when the service is being restarted. [1]: https://github.com/ansible/ansible/issues/27813 [2]: https://github.com/Logan2211/ansible-haproxy-endpoints [3]: https://github.com/Logan2211/tmp-ansible-27813 Change-Id: I7d2f47e94826526e9a5a99d32575f691fb6b30fd
This commit is contained in:
parent
45d84bf792
commit
5842a24cd3
|
@ -33,10 +33,22 @@ Example playbook
|
||||||
.. literalinclude:: ../../examples/playbook.yml
|
.. literalinclude:: ../../examples/playbook.yml
|
||||||
:language: yaml
|
:language: yaml
|
||||||
|
|
||||||
|
External Restart Hooks
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
When the role performs a restart of the 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``, allowing external roles
|
||||||
|
to manage the load balancer endpoints responsible for sending traffic to the
|
||||||
|
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.
|
||||||
|
|
||||||
Tags
|
Tags
|
||||||
~~~~
|
~~~~
|
||||||
|
|
||||||
This role supports two tags: ``glance-install`` and ``glance-config``.
|
This role supports two tags: ``glance-install`` and ``glance-config``.
|
||||||
The ``glance-install`` tag can be used to install and upgrade. The
|
The ``glance-install`` tag can be used to install and upgrade. The
|
||||||
``glance-config`` tag can be used to manage configuration.
|
``glance-config`` tag can be used to manage configuration.
|
||||||
|
|
||||||
|
|
|
@ -56,3 +56,7 @@
|
||||||
retries: 5
|
retries: 5
|
||||||
delay: 2
|
delay: 2
|
||||||
listen: "Restart glance services"
|
listen: "Restart glance services"
|
||||||
|
|
||||||
|
- meta: noop
|
||||||
|
listen: Manage LB
|
||||||
|
when: false
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
group: "root"
|
group: "root"
|
||||||
with_items: "{{ filtered_glance_services }}"
|
with_items: "{{ filtered_glance_services }}"
|
||||||
notify:
|
notify:
|
||||||
|
- Manage LB
|
||||||
- Restart glance services
|
- Restart glance services
|
||||||
|
|
||||||
- name: Place the systemd init script
|
- name: Place the systemd init script
|
||||||
|
@ -62,4 +63,5 @@
|
||||||
config_type: "ini"
|
config_type: "ini"
|
||||||
with_items: "{{ filtered_glance_services }}"
|
with_items: "{{ filtered_glance_services }}"
|
||||||
notify:
|
notify:
|
||||||
|
- Manage LB
|
||||||
- Restart glance services
|
- Restart glance services
|
||||||
|
|
|
@ -81,6 +81,7 @@
|
||||||
copy: "no"
|
copy: "no"
|
||||||
when: glance_get_venv | changed
|
when: glance_get_venv | changed
|
||||||
notify:
|
notify:
|
||||||
|
- Manage LB
|
||||||
- Restart glance services
|
- Restart glance services
|
||||||
|
|
||||||
- name: Install pip packages
|
- name: Install pip packages
|
||||||
|
@ -99,6 +100,7 @@
|
||||||
delay: 2
|
delay: 2
|
||||||
when: glance_get_venv | failed or glance_get_venv | skipped
|
when: glance_get_venv | failed or glance_get_venv | skipped
|
||||||
notify:
|
notify:
|
||||||
|
- Manage LB
|
||||||
- Restart glance services
|
- Restart glance services
|
||||||
|
|
||||||
- name: Remove python from path first (CentOS, openSUSE)
|
- name: Remove python from path first (CentOS, openSUSE)
|
||||||
|
|
|
@ -72,6 +72,7 @@
|
||||||
config_overrides: "{{ glance_glance_rootwrap_conf_overrides }}"
|
config_overrides: "{{ glance_glance_rootwrap_conf_overrides }}"
|
||||||
config_type: "ini"
|
config_type: "ini"
|
||||||
notify:
|
notify:
|
||||||
|
- Manage LB
|
||||||
- Restart glance services
|
- Restart glance services
|
||||||
|
|
||||||
- name: Create nfs shares local path
|
- name: Create nfs shares local path
|
||||||
|
|
|
@ -29,4 +29,5 @@
|
||||||
with_items: "{{ filtered_glance_services }}"
|
with_items: "{{ filtered_glance_services }}"
|
||||||
when: item.wsgi_app | default(False)
|
when: item.wsgi_app | default(False)
|
||||||
notify:
|
notify:
|
||||||
|
- Manage LB
|
||||||
- Restart glance services
|
- Restart glance services
|
||||||
|
|
Loading…
Reference in New Issue