Browse Source

Merge "tripleo_container_manage: continue to reduce tasks" into stable/train

changes/34/742734/13
Zuul 2 weeks ago
committed by Gerrit Code Review
parent
commit
31381f023f
6 changed files with 4 additions and 59 deletions
  1. +1
    -23
      tripleo_ansible/ansible_plugins/action/container_systemd.py
  2. +0
    -1
      tripleo_ansible/roles/tripleo-container-manage/tasks/create.yml
  3. +2
    -16
      tripleo_ansible/roles/tripleo-container-manage/tasks/main.yml
  4. +0
    -12
      tripleo_ansible/roles/tripleo-container-manage/tasks/podman/create.yml
  5. +0
    -7
      tripleo_ansible/roles/tripleo-container-manage/tasks/podman/exec.yml
  6. +1
    -0
      tripleo_ansible/roles/tripleo-container-manage/tasks/shutdown.yml

+ 1
- 23
tripleo_ansible/ansible_plugins/action/container_systemd.py View File

@@ -57,11 +57,6 @@ options:
description:
- Whether or not we cleanup the old healthchecks with SystemD.
type: boolean
restart_containers:
description:
- List of container names to be restarted
default: []
type: list
debug:
default: false
description:
@@ -356,25 +351,9 @@ class ActionModule(ActionBase):
args = self._get_args()

container_config = args['container_config']
restart_containers = args['restart_containers']
self.systemd_healthchecks = args['systemd_healthchecks']
self.debug = args['debug']

extra_restarts = []
for c in restart_containers:
s_path = os.path.join('/etc/systemd/system',
'tripleo_{}.service'.format(c))
service_stat = self._execute_module(
module_name='stat',
module_args=dict(path=s_path),
task_vars=task_vars
)
if service_stat.get('stat', {}).get('exists', False):
if self.debug:
DISPLAY.display('Systemd unit file found for {}, the '
'container will be restarted'.format(c))
extra_restarts.append(c)

container_names = []
for container in container_config:
for name, config in container.items():
@@ -385,8 +364,7 @@ class ActionModule(ActionBase):
changed_services = self._manage_units(container_config, task_vars)
if len(changed_services) > 0:
self._systemd_reload(task_vars)
service_names = set(changed_services + extra_restarts)
self._restart_services(service_names, task_vars)
self._restart_services(changed_services, task_vars)

if self.systemd_healthchecks:
healthchecks_to_restart = []


+ 0
- 1
tripleo_ansible/roles/tripleo-container-manage/tasks/create.yml View File

@@ -25,7 +25,6 @@
container_systemd:
container_config: "{{ container_config }}"
debug: "{{ tripleo_container_manage_debug | bool }}"
restart_containers: "{{ containers_changed | default([]) }}"
systemd_healthchecks: "{{ (not tripleo_container_manage_healthcheck_disabled | bool) }}"
vars:
container_config: "{{ all_containers_hash | dict_to_list | haskey(attribute='restart', value=['always','unless-stopped'], any=True) | default([]) }}"


+ 2
- 16
tripleo_ansible/roles/tripleo-container-manage/tasks/main.yml View File

@@ -63,18 +63,9 @@
all_containers_hash: "{{ container_config_data.configs }}"

- name: "Manage systemd shutdown files"
become: true
include_tasks: shutdown.yml
when:
- tripleo_container_manage_systemd_order
block:
- name: Check if /usr/lib/systemd/system-preset/91-tripleo-container-shutdown.preset exists
stat:
path: /usr/lib/systemd/system-preset/91-tripleo-container-shutdown.preset
register: tripleo_container_shutdown
- name: Include tasks for systemd shutdown service
include_tasks: shutdown.yml
when:
- not tripleo_container_shutdown.stat.exists
- tripleo_container_manage_systemd_order|bool

- name: "Manage containers from {{ tripleo_container_manage_config }}"
when:
@@ -90,8 +81,3 @@
include_tasks: delete_orphan.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 | default('No container action') }}"
when:
- ansible_check_mode|bool

+ 0
- 12
tripleo_ansible/roles/tripleo-container-manage/tasks/podman/create.yml View File

@@ -102,15 +102,3 @@
container_data: "{{ batched_container_data }}"
valid_exit_codes: "{{ tripleo_container_manage_valid_exit_code }}"
debug: "{{ tripleo_container_manage_debug | bool }}"
register: container_status_results

- name: "Create fact for containers which changed"
set_fact:
# List of containers which have changed (created or updated)
containers_changed: "{{ container_status_results.changed_containers | default([]) }}"

- name: "Append the list of all podman commands that are run for containers with changes"
set_fact:
all_containers_commands: "{{ container_status_results.commands | default([]) + (all_containers_commands | default([]) | list) }}"
when:
- ansible_check_mode|bool

+ 0
- 7
tripleo_ansible/roles/tripleo-container-manage/tasks/podman/exec.yml View File

@@ -54,10 +54,3 @@
container_async_results: "{{ exec_async_poll_results.results }}"
container_data: "{{ batched_container_data | haskey(attribute='action', value='exec') }}"
debug: "{{ tripleo_container_manage_debug | bool }}"
register: container_exec_status_results

- name: "Append the list of all podman commands with the containers execs"
set_fact:
all_containers_commands: "{{ container_status_results.commands | default([]) + (all_containers_commands | default([]) | list) }}"
when:
- ansible_check_mode|bool

+ 1
- 0
tripleo_ansible/roles/tripleo-container-manage/tasks/shutdown.yml View File

@@ -61,6 +61,7 @@
- /usr/lib/systemd/system-preset/91-paunch-container-shutdown.preset

- name: Create TripleO Container systemd service
become: true
block:
- name: "Deploy tripleo-container-shutdown and tripleo-start-podman-container"
copy:


Loading…
Cancel
Save