From bb8cb15d20c1d61be92a68ac8fe840e5d6fe1584 Mon Sep 17 00:00:00 2001 From: Jose Luis Franco Arza Date: Mon, 14 Dec 2020 16:23:03 +0100 Subject: [PATCH] Update container-config-scripts/ folder content before update_tasks. Currently, multiple scripts are being stored in /var/lib/container-config-scripts directory if any of theses scripts are being used during the update_tasks the content won't be up to date (or the script will be fully missing if added in a new release), as the content of this folder is being updated during the deploy tasks (step 1), which occurs after all the update_tasks. This patch gathers the tasks responsible for the folder creation and content update into a new playbook named common_container_config_scripts.yaml, this way we can reference the tasks from the deploy-tasks step1 playbook (as it was happening up to now) and invoke them before the update_tasks playbook gets called. Change-Id: I2ac6bb98e1d4183327e888240fc8d5a70e0d6fcb Related-Bug: #1904193 --- common/common-container-config-scripts.yaml | 17 +++++++++++++++++ common/deploy-steps-tasks-step-1.yaml | 18 +----------------- common/deploy-steps.j2 | 2 ++ 3 files changed, 20 insertions(+), 17 deletions(-) create mode 100644 common/common-container-config-scripts.yaml diff --git a/common/common-container-config-scripts.yaml b/common/common-container-config-scripts.yaml new file mode 100644 index 0000000000..41ea793a5f --- /dev/null +++ b/common/common-container-config-scripts.yaml @@ -0,0 +1,17 @@ +- name: Create /var/lib/container-config-scripts + become: true + file: + path: /var/lib/container-config-scripts + state: directory + setype: container_file_t + tags: + - container_config_scripts + +- name: Write container config scripts + become: true + no_log: True + tripleo_container_config_scripts: + config_data: "{{ lookup('file', tripleo_role_name + '/container_config_scripts.yaml', errors='ignore') | default({}, True) | from_yaml }}" + config_dir: /var/lib/container-config-scripts + tags: + - container_config_scripts diff --git a/common/deploy-steps-tasks-step-1.yaml b/common/deploy-steps-tasks-step-1.yaml index 0a5619fc84..35b52746b5 100644 --- a/common/deploy-steps-tasks-step-1.yaml +++ b/common/deploy-steps-tasks-step-1.yaml @@ -175,15 +175,6 @@ tags: - container_config -- name: Create /var/lib/container-config-scripts - become: true - file: - path: /var/lib/container-config-scripts - state: directory - setype: container_file_t - tags: - - container_config_scripts - # The container config files # /var/lib/container-startup-configs.json is removed as we now write # per-step files instead @@ -204,14 +195,7 @@ tags: - container_startup_configs -- name: Write container config scripts - become: true - no_log: True - tripleo_container_config_scripts: - config_data: "{{ lookup('file', tripleo_role_name + '/container_config_scripts.yaml', errors='ignore') | default({}, True) | from_yaml }}" - config_dir: /var/lib/container-config-scripts - tags: - - container_config_scripts +- import_tasks: common_container_config_scripts.yaml # This file location is deprecated and the new location is now: # /var/lib/tripleo-config/container-startup-config/step_X/.json diff --git a/common/deploy-steps.j2 b/common/deploy-steps.j2 index b732ccf95d..865591fc01 100644 --- a/common/deploy-steps.j2 +++ b/common/deploy-steps.j2 @@ -412,6 +412,7 @@ outputs: keystone_resources: {get_param: KeystoneResourcesConfigs} common_deploy_steps_playbooks: {get_file: deploy-steps-playbooks-common.yaml} common_deploy_steps_tasks: {get_file: deploy-steps-tasks.yaml} + common_container_config_scripts: {get_file: common-container-config-scripts.yaml} hiera_steps_tasks: {get_file: hiera-steps-tasks.yaml} deploy_steps_tasks_step_0: {get_file: deploy-steps-tasks-step-0.yaml} common_deploy_steps_tasks_step_1: {get_file: deploy-steps-tasks-step-1.yaml} @@ -821,6 +822,7 @@ outputs: tripleo_minor_update: true tasks: - import_tasks: hiera_steps_tasks.yaml + - import_tasks: common_container_config_scripts.yaml {%- for step in range(0,update_steps_max) %} - import_tasks: "{{ role.name }}/update_tasks_step{{ step }}.yaml" vars: