Octavia: do not attempt container restart on empty list

With composable roles, the node with the octavia agents may not have any
processes running when we hit step 5 external deploy tasks, resulting in
our "one line" restart failing. This patch splits the query for octavia
containers out into a separate task and we conditionally run the restart
task depending on whether there are containers found.

Change-Id: I08a06b300d43aca7db2c9e3341a07bc903163d26
Closes-Bug: #1861413
changes/93/705093/1
Brent Eagles 3 years ago
parent 6f33d53d51
commit 1bafe4df85
  1. 12
      tripleo_ansible/roles/octavia_controller_post_config/tasks/main.yml

@ -49,12 +49,22 @@
when:
- octavia_config_updated
- name: get list of running octavia containers
become: true
shell: |
sudo "{{ container_cli }}" ps -f name=octavia -q
register: running_octavia_containers
when:
- octavia_config_updated
- name: restart octavia containers
become: true
become_user: root
shell: "{{ container_cli }} restart $(sudo {{ container_cli }} ps -f name=octavia -q)"
shell: "{{ container_cli }} restart {{ running_octavia_containers.stdout }}"
when:
- octavia_config_updated
- running_octavia_containers.rc != 0
- (running_octavia_containers.stdout|length) > 0
- name: remove directory /etc/octavia/conf.d/common (LP#1836074)
file:

Loading…
Cancel
Save