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
#
# 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
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: admin_workers, value: "{{ workers }}" }
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
file:
@ -59,9 +65,12 @@
- admin
- main
when: "'eventlet' in '{{ keystone_deployment }}'"
notify:
- restart httpd
- cleanup httpd
- name: Create keystone in httpd wsgi directory
file:
file:
path: /var/www/cgi-bin/keystone
state: directory
owner: keystone
@ -99,6 +108,10 @@
port: 5000
threads: "{{ threads }}"
when: "'httpd' in '{{ keystone_deployment }}'"
notify:
- pacemaker unmanaged default
- stop keystone eventlet
- restart httpd
- name: Configure/Unconfigure httpd ports.conf for keystone
template:
@ -111,29 +124,9 @@
- admin_ip_address: "{{ admin_ip_addr.stdout }}"
public_ip_address: "{{ public_ip_addr.stdout }}"
deployment: "{{ keystone_deployment }}"
#
# Restart keystone services depending on deployment
#
- name: Set pacemaker default to unmanaged
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 }}'"
notify:
- pacemaker unmanaged default
- stop keystone eventlet
- restart keystone
- pacemaker managed default
- cleanup keystone

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: metadata_workers, value: "{{ workers }}" }
- { section: conductor, option: workers, value: "{{ workers }}" }
- name: Unmanage Nova Service from pacemaker
shell: pcs resource unmanage {{ item }}
with_items:
- openstack-nova-conductor
- 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
notify:
- unmanage nova services
- restart nova services
- manage nova services
- cleanup nova services

View File

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

View File

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

View File

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