kolla-ansible/ansible/roles/nova/tasks/do_reconfigure.yml
Vikram Hosakote 1c33173927 Reconfigure nova service
This patch set implements reconfiguring the nova service.

Change-Id: If078efd9ca98f815ca7830de912a4bc8916ff403
Partially-implements: bp kolla-reconfig
2016-03-03 20:48:44 +00:00

213 lines
7.1 KiB
YAML

---
- name: Ensuring the nova libvirt, conductor, api, consoleauth and scheduler containers are up
kolla_docker:
name: "{{ item.name }}"
action: "get_container_state"
register: container_state
failed_when: container_state.Running == false
when: inventory_hostname in groups[item.group]
with_items:
- { name: nova_libvirt, group: compute }
- { name: nova_conductor, group: nova-conductor }
- { name: nova_api, group: nova-api }
- { name: nova_consoleauth, group: nova-consoleauth }
- { name: nova_scheduler, group: nova-scheduler }
- name: Ensuring the nova_compute container is up
kolla_docker:
name: "nova_compute"
action: "get_container_state"
register: container_state
failed_when: container_state.Running == false
when:
- inventory_hostname in groups['compute']
- not enable_nova_fake | bool
- name: Ensuring the nova_compute_ironic container is up
kolla_docker:
name: "nova_compute_ironic"
action: "get_container_state"
register: container_state
failed_when: container_state.Running == false
when:
- inventory_hostname in groups['nova-compute-ironic']
- enable_ironic | bool
- name: Ensuring the nova_novncproxy container is up
kolla_docker:
name: "nova_novncproxy"
action: "get_container_state"
register: container_state
failed_when: container_state.Running == false
when:
- inventory_hostname in groups['nova-novncproxy']
- nova_console == 'novnc'
- name: Ensuring the nova_spicehtml5proxy container is up
kolla_docker:
name: "nova_spicehtml5proxy"
action: "get_container_state"
register: container_state
failed_when: container_state.Running == false
when:
- inventory_hostname in groups['nova-spicehtml5proxy']
- nova_console == 'spice'
- include: config.yml
- name: Check the configs for nova libvirt, conductor, api, consoleauth and scheduler containers
command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check
changed_when: false
failed_when: false
register: check_results
when: inventory_hostname in groups[item.group]
with_items:
- { name: nova_libvirt, group: compute }
- { name: nova_conductor, group: nova-conductor }
- { name: nova_api, group: nova-api }
- { name: nova_consoleauth, group: nova-consoleauth }
- { name: nova_scheduler, group: nova-scheduler }
- name: Check the configs in the nova_compute container
command: docker exec nova_compute /usr/local/bin/kolla_set_configs --check
changed_when: false
failed_when: false
when:
- inventory_hostname in groups['compute']
- not enable_nova_fake | bool
- name: Check the configs in the nova_compute_ironic container
command: docker exec nova_compute_ironic /usr/local/bin/kolla_set_configs --check
changed_when: false
failed_when: false
when:
- inventory_hostname in groups['nova-compute-ironic']
- enable_ironic | bool
- name: Check the configs in the nova_novncproxy container
command: docker exec nova_novncproxy /usr/local/bin/kolla_set_configs --check
changed_when: false
failed_when: false
when:
- inventory_hostname in groups['nova-novncproxy']
- nova_console == 'novnc'
- name: Check the configs in the nova_spicehtml5proxy container
command: docker exec nova_spicehtml5proxy /usr/local/bin/kolla_set_configs --check
changed_when: false
failed_when: false
when:
- inventory_hostname in groups['nova-spicehtml5proxy']
- nova_console == 'spice'
# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS'
# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE',
# just remove the container and start again
- name: Containers config strategy for nova libvirt, conductor, api, consoleauth and scheduler containers
kolla_docker:
name: "{{ item.name }}"
action: "get_container_env"
register: container_envs
when: inventory_hostname in groups[item.group]
with_items:
- { name: nova_libvirt, group: compute }
- { name: nova_conductor, group: nova-conductor }
- { name: nova_api, group: nova-api }
- { name: nova_consoleauth, group: nova-consoleauth }
- { name: nova_scheduler, group: nova-scheduler }
- name: Remove the nova libvirt, conductor, api, consoleauth and scheduler containers
kolla_docker:
name: "{{ item[0]['name'] }}"
action: "remove_container"
register: remove_containers
when:
- config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE'
- item[2]['rc'] == 1
- inventory_hostname in groups[item[0]['group']]
with_together:
- [{ name: nova_libvirt, group: compute },
{ name: nova_conductor, group: nova-conductor },
{ name: nova_api, group: nova-api },
{ name: nova_consoleauth, group: nova-consoleauth },
{ name: nova_scheduler, group: nova-scheduler }]
- container_envs.results
- check_results.results
- include: start.yml
when: remove_containers.changed
- name: Restart the nova libvirt, conductor, api, consoleauth and scheduler containers
kolla_docker:
name: "{{ item[0]['name'] }}"
action: "restart_container"
when:
- config_strategy == 'COPY_ALWAYS'
- item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE'
- item[2]['rc'] == 1
- inventory_hostname in groups[item[0]['group']]
with_together:
- [{ name: nova_libvirt, group: compute },
{ name: nova_conductor, group: nova-conductor },
{ name: nova_api, group: nova-api },
{ name: nova_consoleauth, group: nova-consoleauth },
{ name: nova_scheduler, group: nova-scheduler }]
- container_envs.results
- check_results.results
- name: Restart the nova_compute container
kolla_docker:
name: "nova_compute"
action: "restart_container"
when:
- config_strategy == 'COPY_ALWAYS'
- item[0]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE'
- item[1]['rc'] == 1
- inventory_hostname in groups['compute']
- not enable_nova_fake | bool
with_together:
- container_envs.results
- check_results.results
- name: Restart the nova_compute_ironic container
kolla_docker:
name: "nova_compute_ironic"
action: "restart_container"
when:
- config_strategy == 'COPY_ALWAYS'
- item[0]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE'
- item[1]['rc'] == 1
- inventory_hostname in groups['nova-compute-ironic']
- enable_ironic | bool
with_together:
- container_envs.results
- check_results.results
- name: Restart the nova_novncproxy container
kolla_docker:
name: "nova_novncproxy"
action: "restart_container"
when:
- config_strategy == 'COPY_ALWAYS'
- item[0]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE'
- item[1]['rc'] == 1
- inventory_hostname in groups['nova-novncproxy']
- nova_console == 'novnc'
with_together:
- container_envs.results
- check_results.results
- name: Restart the nova_spicehtml5proxy container
kolla_docker:
name: "nova_spicehtml5proxy"
action: "restart_container"
when:
- config_strategy == 'COPY_ALWAYS'
- item[0]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE'
- item[1]['rc'] == 1
- inventory_hostname in groups['nova-spicehtml5proxy']
- nova_console == 'spice'
with_together:
- container_envs.results
- check_results.results