kolla-ansible/ansible/roles/nova/tasks/upgrade.yml
Michal Nasiadka cea076f379 Introduce oneshot docker_restart_policy
docker_restart_policy: no causes systemd units to not get created
and we use it in CI to disable restarts on services.

Introducing oneshot policy to not create systemd unit for oneshot
containers (those that are running bootstrap tasks, like db
bootstrap and don't need a systemd unit), but still create systemd
units for long lived containers but with Restart=No.

Change-Id: I9e0d656f19143ec2fcad7d6d345b2c9387551604
2023-11-14 15:17:50 +00:00

47 lines
1.4 KiB
YAML

---
- name: Run Nova upgrade checks
become: true
vars:
nova_api: "{{ nova_services['nova-api'] }}"
kolla_docker:
action: "start_container"
common_options: "{{ docker_common_options }}"
detach: False
environment:
KOLLA_UPGRADE_CHECK:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
image: "{{ nova_api.image }}"
labels:
UPGRADE:
name: "nova_upgrade_checks"
restart_policy: oneshot
volumes: "{{ nova_api_default_volumes + nova_api_extra_volumes }}"
run_once: True
register: nova_upgrade_check_stdout
delegate_to: "{{ groups['nova-api'][0] }}"
failed_when: false
check_mode: false
- name: Upgrade status check result
fail:
msg:
- "There was an upgrade status check failure!"
- "See the detail at https://docs.openstack.org/nova/latest/cli/nova-status.html#nova-status-checks"
vars:
first_nova_api_host: "{{ groups['nova-api'][0] }}"
when: hostvars[first_nova_api_host]['nova_upgrade_check_stdout']['rc'] not in [0, 1]
- name: Stopping top level nova services
become: true
kolla_docker:
action: "stop_container"
common_options: "{{ docker_common_options }}"
name: "{{ item.value.container_name }}"
with_dict: "{{ nova_services }}"
when:
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
- nova_safety_upgrade | bool
- import_tasks: rolling_upgrade.yml