From 35cb010cc82f7e78d7cebd855047b0ed9865354a Mon Sep 17 00:00:00 2001 From: Michele Baldessari Date: Wed, 24 Mar 2021 09:27:43 +0100 Subject: [PATCH] Introduce pre_deploy_step_tasks Let's introduce a new set of tasks that will be called after all the groundwork to run containers has been run (so after podman's host_prep_tasks, after the container_setup tasks but before any deployment step or external deployment step). Change-Id: If3c74703a684fbd5a815e073cc9da34e9ad672e8 --- common/deploy-steps.j2 | 45 +++++++++++++++++++ common/services/role.role.j2.yaml | 11 +++++ ...setup_tasks-addition-63a9e4dfccc2132a.yaml | 6 +++ 3 files changed, 62 insertions(+) create mode 100644 releasenotes/notes/pre_deploy_setup_tasks-addition-63a9e4dfccc2132a.yaml diff --git a/common/deploy-steps.j2 b/common/deploy-steps.j2 index bf4cecb91e..469f68c54f 100644 --- a/common/deploy-steps.j2 +++ b/common/deploy-steps.j2 @@ -259,6 +259,16 @@ conditions: resources: + PreDeployStepTasks: + type: OS::Heat::Value + properties: + type: comma_delimited_list + value: + list_concat_unique: + {%- for role in enabled_roles %} + - get_param: [role_data, {{role.name}}, pre_deploy_step_tasks] + {%- endfor %} + ExternalDeployTasks: type: OS::Heat::Value properties: @@ -714,6 +724,40 @@ outputs: - overcloud - container_setup_tasks + - hosts: {{primary_role_name}}:DEPLOY_TARGET_HOST + strategy: tripleo_free + name: Pre Deployment Step Tasks + become: true + gather_facts: "{% raw %}{{ gather_facts | default(false) }}{% endraw %}" + any_errors_fatal: yes + vars: + bootstrap_server_id: BOOTSTRAP_SERVER_ID + deploy_identifier: DEPLOY_IDENTIFIER + enable_debug: ENABLE_DEBUG + enable_puppet: ENABLE_PUPPET + container_cli: CONTAINER_CLI + container_log_stdout_path: CONTAINER_LOG_STDOUT_PATH + container_healthcheck_disabled: CONTAINER_HEALTHCHECK_DISABLED + docker_puppet_debug: DOCKER_PUPPET_DEBUG + docker_puppet_process_count: DOCKER_PUPPET_PROCESS_COUNT + docker_puppet_mount_host_puppet: DOCKER_PUPPET_MOUNT_HOST_PUPPET + tasks: + - name: Pre Deployment Step Tasks + delegate_to: localhost + run_once: true + debug: + msg: Use --start-at-task 'Pre Deployment Step Tasks' to resume from this task +{%- for role in roles %} + - name: {{role.name}} Pre Deployment Step Tasks block + include_tasks: {{role.name}}/pre_deploy_step_tasks.yaml + when: + - tripleo_role_name == '{{role.name}}' + - "'{{role.name}}/pre_deploy_step_tasks.yaml' is exists" +{%- endfor %} + tags: + - overcloud + - pre_deploy_steps_tasks + {%- for step in range(1,deploy_steps_max) %} - hosts: DEPLOY_SOURCE_HOST @@ -877,6 +921,7 @@ outputs: external_deploy_steps_tasks: {get_attr: [ExternalDeployTasks, value]} external_post_deploy_steps_tasks: {get_attr: [ExternalPostDeployTasks, value]} + pre_deploy_step_tasks: {get_attr: [PreDeployStepTasks, value]} update_steps_playbook: {{ self.deploy_steps_str_replace_params() }} template: | diff --git a/common/services/role.role.j2.yaml b/common/services/role.role.j2.yaml index 7cfff0b5bb..fc879575f4 100644 --- a/common/services/role.role.j2.yaml +++ b/common/services/role.role.j2.yaml @@ -311,6 +311,16 @@ resources: expression: coalesce($.data, []).where($ != null).select($.get('host_prep_tasks')).where($ != null).flatten().distinct() data: {get_attr: [ServiceChain, role_data]} + PreDeployStepTasks: + type: OS::Heat::Value + properties: + type: comma_delimited_list + value: + yaql: + # Note we use distinct() here to filter any identical tasks + expression: coalesce($.data, []).where($ != null).select($.get('pre_deploy_step_tasks')).where($ != null).flatten().distinct() + data: {get_attr: [ServiceChain, role_data]} + AnsibleGroupVars: type: OS::Heat::Value properties: @@ -381,3 +391,4 @@ outputs: vars: tripleo_firewall_rules: {get_attr: [FirewallRules, value]} - {get_attr: [HostPrepTasks, value]} + pre_deploy_step_tasks: {get_attr: [PreDeployStepTasks, value]} diff --git a/releasenotes/notes/pre_deploy_setup_tasks-addition-63a9e4dfccc2132a.yaml b/releasenotes/notes/pre_deploy_setup_tasks-addition-63a9e4dfccc2132a.yaml new file mode 100644 index 0000000000..f6ff22cfa6 --- /dev/null +++ b/releasenotes/notes/pre_deploy_setup_tasks-addition-63a9e4dfccc2132a.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Adds pre_deploy_step_tasks support which is run after kolla files are setup + and podman is configured, but before any deployment task or external deployment + task. The use case is being able to start containers before any deployment task.