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
This commit is contained in:
Michele Baldessari 2021-03-24 09:27:43 +01:00
parent 7d48e49301
commit 35cb010cc8
3 changed files with 62 additions and 0 deletions

View File

@ -259,6 +259,16 @@ conditions:
resources: 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: ExternalDeployTasks:
type: OS::Heat::Value type: OS::Heat::Value
properties: properties:
@ -714,6 +724,40 @@ outputs:
- overcloud - overcloud
- container_setup_tasks - 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) %} {%- for step in range(1,deploy_steps_max) %}
- hosts: DEPLOY_SOURCE_HOST - hosts: DEPLOY_SOURCE_HOST
@ -877,6 +921,7 @@ outputs:
external_deploy_steps_tasks: {get_attr: [ExternalDeployTasks, value]} external_deploy_steps_tasks: {get_attr: [ExternalDeployTasks, value]}
external_post_deploy_steps_tasks: {get_attr: [ExternalPostDeployTasks, value]} external_post_deploy_steps_tasks: {get_attr: [ExternalPostDeployTasks, value]}
pre_deploy_step_tasks: {get_attr: [PreDeployStepTasks, value]}
update_steps_playbook: update_steps_playbook:
{{ self.deploy_steps_str_replace_params() }} {{ self.deploy_steps_str_replace_params() }}
template: | template: |

View File

@ -311,6 +311,16 @@ resources:
expression: coalesce($.data, []).where($ != null).select($.get('host_prep_tasks')).where($ != null).flatten().distinct() expression: coalesce($.data, []).where($ != null).select($.get('host_prep_tasks')).where($ != null).flatten().distinct()
data: {get_attr: [ServiceChain, role_data]} 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: AnsibleGroupVars:
type: OS::Heat::Value type: OS::Heat::Value
properties: properties:
@ -381,3 +391,4 @@ outputs:
vars: vars:
tripleo_firewall_rules: {get_attr: [FirewallRules, value]} tripleo_firewall_rules: {get_attr: [FirewallRules, value]}
- {get_attr: [HostPrepTasks, value]} - {get_attr: [HostPrepTasks, value]}
pre_deploy_step_tasks: {get_attr: [PreDeployStepTasks, value]}

View File

@ -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.