Skip to content

Commit 40cab15

Browse files
committed
Use fact for hotfix containers list
1 parent aa1b171 commit 40cab15

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

etc/kayobe/ansible/hotfix-containers.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,13 @@
2828
command: '{{ kolla_container_engine | default("docker")}} ps --format {% raw %}"{{.Names}}"{% endraw %}'
2929
register: host_containers
3030

31+
- name: Set fact for containers list
32+
set_fact:
33+
containers_list: host_containers.stdout
34+
3135
- name: Fail if no containers match given regex
3236
vars:
33-
hotfix_containers: host_containers | split('\n') | regex_search(container_hotfix_container_regex)
37+
hotfix_containers: "{{ containers_list | split('\n') | regex_search(container_hotfix_container_regex) }}"
3438
fail:
3539
msg: "No containers matched. Please check your regex. Containers running on host: {{ host_containers | split('\n') }}"
3640
when: hotfix_containers == ""
@@ -51,7 +55,7 @@
5155

5256
- name: Apply hotfix
5357
include_tasks: run-container-hotfix.yml
54-
loop: "{{ host_containers.stdout | regex_findall(container_hotfix_container_regex, multiline=True) | list | unique }}"
58+
loop: "{{ containers_list | regex_findall(container_hotfix_container_regex, multiline=True) | list | unique }}"
5559
loop_control:
5660
loop_var: hotfix_container
5761

@@ -62,5 +66,5 @@
6266

6367
- name: Restart containers if requested
6468
command: "{{ kolla_container_engine | default('docker')}} restart {{ item }}"
65-
loop: "{{ host_containers.stdout | regex_findall(container_hotfix_container_regex, multiline=True) | list | unique }}"
69+
loop: "{{ containers_list | regex_findall(container_hotfix_container_regex, multiline=True) | list | unique }}"
6670
when: container_hotfix_restart_containers

0 commit comments

Comments
 (0)