Merge "tripleo-container-manage: show podman commands that are executed" into stable/train

This commit is contained in:
Zuul 2020-02-07 21:06:04 +00:00 committed by Gerrit Code Review
commit c7c8c92aba
3 changed files with 44 additions and 8 deletions

View File

@ -93,3 +93,8 @@
include_tasks: delete.yml
- name: "Create containers from {{ tripleo_container_manage_config }}"
include_tasks: create.yml
- name: "Show all container commands for {{ tripleo_container_manage_config }}"
debug:
msg: "{{ all_containers_commands }}"
when:
- ansible_check_mode|bool

View File

@ -15,12 +15,9 @@
# under the License.
- name: "Async container create/run"
async: 300
poll: 0
async: "{{ (not ansible_check_mode | bool) | ternary('300', omit) }}"
poll: "{{ (not ansible_check_mode | bool) | ternary('0', omit) }}"
register: create_async_results
# async and check mode don't work together
when:
- not ansible_check_mode|bool
loop: "{{ batched_container_data | haskey(attribute='action', reverse=True) }}"
loop_control:
loop_var: container_data
@ -75,7 +72,6 @@
register: create_async_poll_results
until: create_async_poll_results.finished
retries: 30
# async and check mode don't work together
when:
- not ansible_check_mode|bool
@ -87,6 +83,22 @@
{{ create_async_results.results | selectattr('changed', 'equalto', true) |
map(attribute='container_data') | list | list_of_keys }}
- name: Block for container commands
when:
- ansible_check_mode|bool
block:
- name: "Create a list of podman commands that are run for containers with changes"
set_fact:
containers_commands: >-
{{ create_async_results.results | selectattr('changed', 'equalto', true) |
map(attribute='podman_actions') | default([]) | list }}
- name: "Print the list of commands that are run for containers with changes"
debug:
var: containers_commands
- name: "Append the list of all podman commands that are run for containers with changes"
set_fact:
all_containers_commands: "{{ containers_commands + (all_containers_commands | default([]) | list) }}"
- name: "Print the list of containers which changed"
debug:
var: containers_changed

View File

@ -24,8 +24,8 @@
- name: "Async container exec"
command:
argv: "{{ lookup('dict', container_exec_data).value | container_exec_cmd(cli=tripleo_container_manage_cli) }}"
async: 60
poll: 0
async: "{{ (not ansible_check_mode | bool) | ternary('60', omit) }}"
poll: "{{ (not ansible_check_mode | bool) | ternary('0', omit) }}"
register: exec_async_results
loop: "{{ batched_container_data | haskey(attribute='action', value='exec') }}"
loop_control:
@ -42,3 +42,22 @@
until: exec_async_poll_results.finished
retries: 30
when: not ansible_check_mode|bool
- name: Block for container commands
when:
- ansible_check_mode|bool
block:
- name: "Create a list of podman exec commands that are run"
set_fact:
containers_commands: >-
{{ (containers_commands | default([])) + ([lookup('dict', container_exec_data).value |
container_exec_cmd(cli=tripleo_container_manage_cli) | join(' ')]) }}
loop: "{{ batched_container_data | haskey(attribute='action', value='exec') }}"
loop_control:
loop_var: container_exec_data
- name: "Print the list of podman exec commands that are run"
debug:
var: containers_commands
- name: "Append the list of all podman commands that are run for containers with changes"
set_fact:
all_containers_commands: "{{ containers_commands + (all_containers_commands | default([]) | list) }}"