Assert container's ssl cert exists before upgrade.

While performing upgrade from Q to R undercloud is switched
from non-containerized to containerized, so some kolla* specific
dirs/files might not exist.
This change adds asserts if that dirs exis before manipulating
them.

Change-Id: I0fe99cc5cd10c7f78798e31435058908d0184973
This commit is contained in:
Yurii Prokulevych 2018-08-06 10:58:00 +02:00
parent 5789a9694a
commit eb76fb957f
1 changed files with 8 additions and 0 deletions

View File

@ -180,11 +180,19 @@ outputs:
- name: set kolla_dir fact
set_fact: kolla_dir="/var/lib/kolla/config_files/src-tls"
- name: assert {{ kolla_dir }}{{ cert_path }} exists
stat:
path: "{{ kolla_dir }}{{cert_path}}"
register: kolla_cert_exists
- name: set certificate group on host via container
command: docker exec {{container_id.stdout}} chgrp haproxy {{kolla_dir}}{{cert_path}}
when: kolla_cert_exists.stat.exists
- name: copy certificate from kolla directory to final location
command: docker exec {{container_id.stdout}} cp {{kolla_dir}}{{cert_path}} {{cert_path}}
when: kolla_cert_exists.stat.exists
- name: send restart order to haproxy container
command: docker kill --signal=HUP {{container_id.stdout}}
when: kolla_cert_exists.stat.exists