Browse Source

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

changes/40/705440/3
Zuul Gerrit Code Review 2 weeks ago
parent
commit
c7c8c92aba
3 changed files with 44 additions and 8 deletions
  1. +5
    -0
      tripleo_ansible/roles/tripleo-container-manage/tasks/main.yml
  2. +18
    -6
      tripleo_ansible/roles/tripleo-container-manage/tasks/podman/create.yml
  3. +21
    -2
      tripleo_ansible/roles/tripleo-container-manage/tasks/podman/exec.yml

+ 5
- 0
tripleo_ansible/roles/tripleo-container-manage/tasks/main.yml 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

+ 18
- 6
tripleo_ansible/roles/tripleo-container-manage/tasks/podman/create.yml 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


+ 21
- 2
tripleo_ansible/roles/tripleo-container-manage/tasks/podman/exec.yml 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) }}"

Loading…
Cancel
Save