Andy McCrae 97cf209d69 Use handlers based on filtered_nova_services
Change-Id: I3f9cde33af0a5f2aaeb0aedc964cb03a40ccbb9f
2017-05-08 14:47:46 +00:00

79 lines
2.2 KiB
YAML

---
# Copyright 2015, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Restart libvirt-bin
systemd:
name: "{{ libvirt_service_name }}"
state: "restarted"
daemon_reload: yes
- name: Restart nova services
command: /bin/true
notify:
- Restart nova conductor
- Restart nova API
- Restart nova misc services
- Restart nova compute
- name: Restart nova conductor
systemd:
name: "{{ nova_services['nova-conductor']['service_name'] }}"
state: "restarted"
daemon_reload: yes
register: nova_conductor_restart
when: '"nova-conductor" in filtered_nova_services'
- name: Restart nova API
systemd:
name: "{{ nova_services['nova-api-os-compute']['service_name'] }}"
state: "restarted"
daemon_reload: yes
register: nova_api_restart
when: '"nova-api-os-compute" in filtered_nova_services'
# Used for services where restart ordering does not matter
- name: Restart nova misc services
systemd:
name: "{{ nova_services[item]['service_name'] }}"
state: "restarted"
daemon_reload: yes
register: nova_misc_restart
with_items:
- nova-api-metadata
- nova-consoleauth
- nova-novncproxy
- nova-scheduler
- nova-spicehtml5proxy
- nova-placement-api
when: 'item in filtered_nova_services'
- name: Restart nova compute
systemd:
name: "{{ nova_services['nova-compute']['service_name'] }}"
state: "restarted"
daemon_reload: yes
register: nova_compute_restart
when: '"nova-compute" in filtered_nova_services'
- name: Reload Nginx
systemd:
name: nginx
enabled: yes
state: reloaded
register: nova_nginx_restart
until: nova_nginx_restart | success
retries: 5
delay: 2
when: inventory_hostname in groups['nova_api_placement']