Ordered service restarts

Use specific ordering for nova service restarts.

Change-Id: I29e17c09c6aa1b626aead8e4916cc89604a371d6
This commit is contained in:
Logan V 2017-02-20 13:42:14 -06:00
parent 6fc78d941c
commit 5c99b10178
2 changed files with 48 additions and 6 deletions

View File

@ -19,14 +19,56 @@
daemon_reload: yes daemon_reload: yes
- name: Restart nova services - 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: systemd:
name: "{{ item.value.service_name }}" name: "{{ nova_services['nova-conductor']['service_name'] }}"
state: "restarted" state: "restarted"
with_dict: "{{ nova_services }}" register: nova_conductor_restart
register: nova_service_restart
when: when:
- inventory_hostname in groups[item.value.group] - "{{ nova_services['nova-conductor']['group'] in group_names }}"
- "{{ item.value.condition | default(true) }}" - "{{ nova_services['nova-conductor']['condition'] | default(true) }}"
- name: Restart nova API
systemd:
name: "{{ nova_services['nova-api-os-compute']['service_name'] }}"
state: "restarted"
register: nova_api_restart
when:
- "{{ nova_services['nova-api-os-compute']['group'] in group_names }}"
- "{{ nova_services['nova-api-os-compute']['condition'] | default(true) }}"
# Used for services where restart ordering does not matter
- name: Restart nova misc services
systemd:
name: "{{ nova_services[item]['service_name'] }}"
state: "restarted"
register: nova_misc_restart
with_items:
- nova-api-metadata
- nova-consoleauth
- nova-novncproxy
- nova-scheduler
- nova-spicehtml5proxy
- nova-placement-api
when:
- "{{ nova_services[item]['group'] in group_names }}"
- "{{ nova_services[item]['condition'] | default(true) }}"
- name: Restart nova compute
systemd:
name: "{{ nova_services['nova-compute']['service_name'] }}"
state: "restarted"
register: nova_compute_restart
when:
- "{{ nova_services['nova-compute']['group'] in group_names }}"
- "{{ nova_services['nova-compute']['condition'] | default(true) }}"
- name: Restart Nginx - name: Restart Nginx
systemd: systemd:

View File

@ -88,7 +88,7 @@
- include: nova_compute_wait.yml - include: nova_compute_wait.yml
when: when:
- "{{ 'nova_compute' in group_names }}" - "{{ 'nova_compute' in group_names }}"
- "{{ nova_service_restart | default(dict(changed=False)) | changed }}" - "{{ nova_compute_restart | default(dict(changed=False)) | changed }}"
- "{{ nova_discover_hosts_in_cells_interval | int < 1 }}" - "{{ nova_discover_hosts_in_cells_interval | int < 1 }}"
tags: tags:
- nova-config - nova-config