Use handlers to restart services at end of plays.

Change-Id: I2368b94e30e091a3f522f98020d635aaf3d76ccd
This commit is contained in:
Alex Krzos 2015-12-17 08:46:52 -05:00
parent 1d7ebf43ef
commit 850c50eed5
8 changed files with 111 additions and 68 deletions

View File

@ -2,6 +2,12 @@
# #
# Playbook to change number of workers for nova and keystone services # Playbook to change number of workers for nova and keystone services
# #
# Change Workers Example:
# ansible-playbook -i hosts browbeat/adjustment.yml -e "workers=12"
#
# Change Workers and Keystone Deployment Example:
# ansible-playbook -i hosts browbeat/adjustment.yml -e "workers=12 keystone_deployment=httpd"
#
- hosts: controller - hosts: controller
remote_user: heat-admin remote_user: heat-admin

View File

@ -0,0 +1,34 @@
---
#
# Keystone handlers for browbeat adjustment
#
- name: pacemaker unmanaged default
command: pcs property set is-managed-default=false
ignore_errors: true
- name: stop keystone eventlet
service: name=openstack-keystone state=stopped
when: "'httpd' in '{{ keystone_deployment }}'"
ignore_errors: true
- name: restart httpd
service: name=httpd state=restarted
- name: restart keystone
service: name=openstack-keystone state=restarted
when: "'eventlet' in '{{ keystone_deployment }}'"
- name: pacemaker managed default
command: pcs property set is-managed-default=true
when: "'eventlet' in '{{ keystone_deployment }}'"
ignore_errors: true
- name: cleanup keystone
command: pcs resource cleanup openstack-keystone
when: "'eventlet' in '{{ keystone_deployment }}'"
ignore_errors: true
- name: cleanup httpd
command: pcs resource cleanup httpd
ignore_errors: true

View File

@ -50,6 +50,12 @@
- { section: eventlet_server, option: public_workers, value: "{{ workers }}" } - { section: eventlet_server, option: public_workers, value: "{{ workers }}" }
- { section: eventlet_server, option: admin_workers, value: "{{ workers }}" } - { section: eventlet_server, option: admin_workers, value: "{{ workers }}" }
when: "'eventlet' in '{{ keystone_deployment }}'" when: "'eventlet' in '{{ keystone_deployment }}'"
notify:
- pacemaker unmanaged default
- stop keystone eventlet
- restart keystone
- pacemaker managed default
- cleanup keystone
- name: Unconfigure keystone in httpd if eventlet - name: Unconfigure keystone in httpd if eventlet
file: file:
@ -59,6 +65,9 @@
- admin - admin
- main - main
when: "'eventlet' in '{{ keystone_deployment }}'" when: "'eventlet' in '{{ keystone_deployment }}'"
notify:
- restart httpd
- cleanup httpd
- name: Create keystone in httpd wsgi directory - name: Create keystone in httpd wsgi directory
file: file:
@ -99,6 +108,10 @@
port: 5000 port: 5000
threads: "{{ threads }}" threads: "{{ threads }}"
when: "'httpd' in '{{ keystone_deployment }}'" when: "'httpd' in '{{ keystone_deployment }}'"
notify:
- pacemaker unmanaged default
- stop keystone eventlet
- restart httpd
- name: Configure/Unconfigure httpd ports.conf for keystone - name: Configure/Unconfigure httpd ports.conf for keystone
template: template:
@ -111,29 +124,9 @@
- admin_ip_address: "{{ admin_ip_addr.stdout }}" - admin_ip_address: "{{ admin_ip_addr.stdout }}"
public_ip_address: "{{ public_ip_addr.stdout }}" public_ip_address: "{{ public_ip_addr.stdout }}"
deployment: "{{ keystone_deployment }}" deployment: "{{ keystone_deployment }}"
notify:
# - pacemaker unmanaged default
# Restart keystone services depending on deployment - stop keystone eventlet
# - restart keystone
- pacemaker managed default
- name: Set pacemaker default to unmanaged - cleanup keystone
command: pcs property set is-managed-default=false
- name: Stop keystone service in eventlet
service: name=openstack-keystone state=stopped
when: "'httpd' in '{{ keystone_deployment }}'"
- name: Restart httpd service
service: name=httpd state=restarted
- name: Restart keystone service in eventlet
service: name=openstack-keystone state=restarted
when: "'eventlet' in '{{ keystone_deployment }}'"
- name: Set pacemaker default to managed for eventlet
command: pcs property set is-managed-default=true
when: "'eventlet' in '{{ keystone_deployment }}'"
- name: Cleanup keystone service in pacemaker
command: pcs resource cleanup openstack-keystone
when: "'eventlet' in '{{ keystone_deployment }}'"

View File

@ -0,0 +1,35 @@
---
#
# Nova handlers for browbeat adjustment
#
- name: unmanage nova services
command: pcs resource unmanage {{ item }}
with_items:
- openstack-nova-api
- openstack-nova-scheduler
- openstack-nova-conductor
ignore_errors: true
- name: restart nova services
service: name={{ item }} state=restarted
with_items:
- openstack-nova-api
- openstack-nova-scheduler
- openstack-nova-conductor
- name: manage nova services
command: pcs resource manage {{ item }}
with_items:
- openstack-nova-api
- openstack-nova-scheduler
- openstack-nova-conductor
ignore_errors: true
- name: cleanup nova services
command: pcs resource cleanup {{ item }}
with_items:
- openstack-nova-api
- openstack-nova-scheduler
- openstack-nova-conductor
ignore_errors: true

View File

@ -19,24 +19,8 @@
- { section: DEFAULT, option: osapi_compute_workers, value: "{{ workers }}" } - { section: DEFAULT, option: osapi_compute_workers, value: "{{ workers }}" }
- { section: DEFAULT, option: metadata_workers, value: "{{ workers }}" } - { section: DEFAULT, option: metadata_workers, value: "{{ workers }}" }
- { section: conductor, option: workers, value: "{{ workers }}" } - { section: conductor, option: workers, value: "{{ workers }}" }
notify:
- name: Unmanage Nova Service from pacemaker - unmanage nova services
shell: pcs resource unmanage {{ item }} - restart nova services
with_items: - manage nova services
- openstack-nova-conductor - cleanup nova services
- openstack-nova-api
- openstack-nova-scheduler
- name: Restart Nova services
service: name={{ item }} state=restarted
with_items:
- openstack-nova-conductor
- openstack-nova-api
- openstack-nova-scheduler
- name: Manage Nova Service from pacemaker
shell: pcs resource manage {{ item }}
with_items:
- openstack-nova-conductor
- openstack-nova-api
- openstack-nova-scheduler

View File

@ -1,6 +1,6 @@
--- ---
# #
# Keystone handlers # Keystone handlers for browbeat install connmon
# #
# #
@ -9,8 +9,7 @@
- name: restart httpd - name: restart httpd
service: name=httpd state=restarted service: name=httpd state=restarted
when: "connmon and 'httpd' == '{{ keystone_deployment }}'" when: "'httpd' == '{{ keystone_deployment }}'"
ignore_errors: true
# #
# Restart keystone when in eventlet # Restart keystone when in eventlet
@ -18,19 +17,19 @@
- name: unmanage keystone - name: unmanage keystone
command: pcs resource unmanage openstack-keystone command: pcs resource unmanage openstack-keystone
when: "connmon and 'eventlet' == '{{ keystone_deployment }}'" when: "'eventlet' == '{{ keystone_deployment }}'"
ignore_errors: true ignore_errors: true
- name: restart keystone - name: restart keystone
service: name=openstack-keystone state=restarted service: name=openstack-keystone state=restarted
when: "connmon and 'eventlet' == '{{ keystone_deployment }}'" when: "'eventlet' == '{{ keystone_deployment }}'"
- name: manage keystone - name: manage keystone
command: pcs resource manage openstack-keystone command: pcs resource manage openstack-keystone
when: "connmon and 'eventlet' == '{{ keystone_deployment }}'" when: "'eventlet' == '{{ keystone_deployment }}'"
ignore_errors: true ignore_errors: true
- name: cleanup keystone - name: cleanup keystone
command: pcs resource cleanup openstack-keystone command: pcs resource cleanup openstack-keystone
when: "connmon and 'eventlet' == '{{ keystone_deployment }}'" when: "'eventlet' == '{{ keystone_deployment }}'"
ignore_errors: true ignore_errors: true

View File

@ -5,19 +5,15 @@
- name: unmanage neutron-server - name: unmanage neutron-server
command: pcs resource unmanage neutron-server command: pcs resource unmanage neutron-server
when: connmon
ignore_errors: true ignore_errors: true
- name: restart neutron-server - name: restart neutron-server
service: name=neutron-server state=restarted service: name=neutron-server state=restarted
when: connmon
- name: manage neutron-server - name: manage neutron-server
command: pcs resource manage neutron-server command: pcs resource manage neutron-server
when: connmon
ignore_errors: true ignore_errors: true
- name: cleanup neutron-server - name: cleanup neutron-server
command: pcs resource cleanup neutron-server command: pcs resource cleanup neutron-server
when: connmon
ignore_errors: true ignore_errors: true

View File

@ -1,39 +1,35 @@
--- ---
# #
# Nova handlers # Nova handlers for browbeat install connmon
# #
- name: unmanage nova services - name: unmanage nova services
command: pcs resource unmanage {{ item }} command: pcs resource unmanage {{ item }}
with_items: with_items:
- openstack-nova-conductor
- openstack-nova-api - openstack-nova-api
- openstack-nova-scheduler - openstack-nova-scheduler
when: connmon - openstack-nova-conductor
ignore_errors: true ignore_errors: true
- name: restart nova services - name: restart nova services
service: name={{ item }} state=restarted service: name={{ item }} state=restarted
with_items: with_items:
- openstack-nova-conductor
- openstack-nova-api - openstack-nova-api
- openstack-nova-scheduler - openstack-nova-scheduler
when: connmon - openstack-nova-conductor
- name: manage nova services - name: manage nova services
command: pcs resource manage {{ item }} command: pcs resource manage {{ item }}
with_items: with_items:
- openstack-nova-conductor
- openstack-nova-api - openstack-nova-api
- openstack-nova-scheduler - openstack-nova-scheduler
when: connmon - openstack-nova-conductor
ignore_errors: true ignore_errors: true
- name: cleanup nova services - name: cleanup nova services
command: pcs resource cleanup {{ item }} command: pcs resource cleanup {{ item }}
with_items: with_items:
- openstack-nova-conductor
- openstack-nova-api - openstack-nova-api
- openstack-nova-scheduler - openstack-nova-scheduler
when: connmon - openstack-nova-conductor
ignore_errors: true ignore_errors: true