diff --git a/doc/source/index.rst b/doc/source/index.rst index 318b090c..dd690973 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -47,6 +47,19 @@ Example playbook .. literalinclude:: ../../examples/playbook.yml :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 `_ +used by the openstack-ansible project. + Tags ~~~~ @@ -56,4 +69,3 @@ The ``cinder-install`` tag can be used to install and upgrade. The ``cinder-config`` tag can be used to maintain configuration of the service. - diff --git a/handlers/main.yml b/handlers/main.yml index d88cdeb8..b31d9029 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -67,3 +67,7 @@ enabled: yes state: restarted daemon_reload: "{{ (ansible_service_mgr == 'systemd') | ternary('yes', omit) }}" + +- meta: noop + listen: Manage LB + when: false diff --git a/tasks/cinder_init_systemd.yml b/tasks/cinder_init_systemd.yml index d22cb762..62b9096e 100644 --- a/tasks/cinder_init_systemd.yml +++ b/tasks/cinder_init_systemd.yml @@ -50,6 +50,7 @@ group: "root" with_items: "{{ filtered_cinder_services }}" notify: + - Manage LB - Restart cinder services - name: Place the systemd init script @@ -63,4 +64,5 @@ config_type: "ini" with_items: "{{ filtered_cinder_services }}" notify: + - Manage LB - Restart cinder services diff --git a/tasks/cinder_install.yml b/tasks/cinder_install.yml index 71855dd2..ef0ec1d5 100644 --- a/tasks/cinder_install.yml +++ b/tasks/cinder_install.yml @@ -80,7 +80,9 @@ dest: "{{ cinder_bin | dirname }}" copy: "no" when: cinder_get_venv | changed - notify: Restart cinder services + notify: + - Manage LB + - Restart cinder services - name: Install pip packages pip: @@ -97,7 +99,9 @@ retries: 5 delay: 2 when: cinder_get_venv | failed or cinder_get_venv | skipped - notify: Restart cinder services + notify: + - Manage LB + - Restart cinder services - name: Remove python from path first (CentOS, openSUSE) file: diff --git a/tasks/cinder_post_install.yml b/tasks/cinder_post_install.yml index 1fa3f57f..048de668 100644 --- a/tasks/cinder_post_install.yml +++ b/tasks/cinder_post_install.yml @@ -40,6 +40,7 @@ config_overrides: "{{ cinder_policy_overrides }}" config_type: "json" notify: + - Manage LB - Restart cinder services - name: Copy cinder configs @@ -51,6 +52,7 @@ with_fileglob: - rootwrap.d/* notify: + - Manage LB - Restart cinder services - name: Ensure cinder tgt include diff --git a/tasks/cinder_uwsgi.yml b/tasks/cinder_uwsgi.yml index c0a70562..d18f7ea0 100644 --- a/tasks/cinder_uwsgi.yml +++ b/tasks/cinder_uwsgi.yml @@ -29,4 +29,5 @@ with_items: "{{ filtered_cinder_services }}" when: item.wsgi_app | default(False) notify: + - Manage LB - Restart cinder services