diff options
Diffstat (limited to 'docker/docker-steps.j2')
-rw-r--r-- | docker/docker-steps.j2 | 116 |
1 files changed, 39 insertions, 77 deletions
diff --git a/docker/docker-steps.j2 b/docker/docker-steps.j2 index ab75b7eb..05ff7945 100644 --- a/docker/docker-steps.j2 +++ b/docker/docker-steps.j2 @@ -49,34 +49,17 @@ conditions: {% for step in range(1, deploy_steps_max) %} WorkflowTasks_Step{{step}}_Enabled: or: - {% for role in roles %} + {%- for role in roles %} - not: equals: - get_param: [role_data, {{role.name}}, service_workflow_tasks, step{{step}}] - '' - False - {% endfor %} + {%- endfor %} {% endfor %} resources: - # These utility tasks use docker-puppet.py to execute tasks via puppet - # We only execute these on the first node in the primary role - {{primary_role_name}}DockerPuppetTasks: - type: OS::Heat::Value - properties: - type: json - value: - yaql: - expression: - $.data.default_tasks + dict($.data.docker_puppet_tasks.where($1 != null).selectMany($.items()).groupBy($[0], $[1])) - data: - docker_puppet_tasks: {get_param: [role_data, {{primary_role_name}}, docker_puppet_tasks]} - default_tasks: -{%- for step in range(1, deploy_steps_max) %} - step_{{step}}: {} -{%- endfor %} - RoleConfig: type: OS::Heat::SoftwareConfig properties: @@ -97,16 +80,16 @@ resources: type: OS::Mistral::Workflow condition: WorkflowTasks_Step{{step}}_Enabled depends_on: - {% if step == 1 %} - {% for dep in roles %} + {%- if step == 1 %} + {%- for dep in roles %} - {{dep.name}}PreConfig - {{dep.name}}ArtifactsDeploy - {% endfor %} - {% else %} - {% for dep in roles %} + {%- endfor %} + {%- else %} + {%- for dep in roles %} - {{dep.name}}Deployment_Step{{step -1}} - {% endfor %} - {% endif %} + {%- endfor %} + {%- endif %} properties: name: {list_join: [".", ["tripleo", {get_param: stack_name}, "workflowtasks", "step{{step}}"]]} type: direct @@ -114,9 +97,9 @@ resources: yaql: expression: $.data.where($ != '').select($.get('step{{step}}')).where($ != null).flatten() data: - {% for role in roles %} + {%- for role in roles %} - get_param: [role_data, {{role.name}}, service_workflow_tasks] - {% endfor %} + {%- endfor %} WorkflowTasks_Step{{step}}_Execution: type: OS::Mistral::ExternalResource @@ -130,18 +113,20 @@ resources: env: service_ips: { get_param: ctlplane_service_ips } role_merged_configs: - {% for r in roles %} + {%- for r in roles %} {{r.name}}: {get_param: [role_data, {{r.name}}, merged_config_settings]} - {% endfor %} + {%- endfor %} + evaluate_env: false UPDATE: workflow: { get_resource: WorkflowTasks_Step{{step}} } params: env: service_ips: { get_param: ctlplane_service_ips } role_merged_configs: - {% for r in roles %} + {%- for r in roles %} {{r.name}}: {get_param: [role_data, {{r.name}}, merged_config_settings]} - {% endfor %} + {%- endfor %} + evaluate_env: false always_update: true # END service_workflow_tasks handling {% endfor %} @@ -175,11 +160,11 @@ resources: vars: puppet_config: {get_param: [role_data, {{role.name}}, puppet_config]} docker_puppet_script: {get_file: docker-puppet.py} - docker_puppet_tasks: {get_attr: [{{primary_role_name}}DockerPuppetTasks, value]} - docker_startup_configs: {get_attr: [{{role.name}}DockerConfig, value]} + docker_puppet_tasks: {get_param: [role_data, {{role.name}}, docker_puppet_tasks]} + docker_startup_configs: {get_param: [role_data, {{role.name}}, docker_config]} kolla_config: {get_param: [role_data, {{role.name}}, kolla_config]} bootstrap_server_id: {get_param: [servers, {{primary_role_name}}, '0']} - puppet_step_config: {get_attr: [{{role.name}}PuppetStepConfig, value]} + puppet_step_config: {get_param: [role_data, {{role.name}}, step_config]} tasks: # Join host_prep_tasks with the other per-host configuration yaql: @@ -193,10 +178,9 @@ resources: file: path=/var/lib/tripleo-config state=directory - name: Write the puppet step_config manifest copy: content="{{puppet_step_config}}" dest=/var/lib/tripleo-config/puppet_step_config.pp force=yes - # This is the docker-puppet configs end in + # this creates a JSON config file for our docker-puppet.py script - name: Create /var/lib/docker-puppet file: path=/var/lib/docker-puppet state=directory - # this creates a JSON config file for our docker-puppet.py script - name: Write docker-puppet-tasks json files copy: content="{{puppet_config | to_json}}" dest=/var/lib/docker-puppet/docker-puppet.json force=yes # FIXME: can we move docker-puppet somewhere so it's installed via a package? @@ -220,6 +204,13 @@ resources: ######################################################## # Bootstrap tasks, only performed on bootstrap_server_id ######################################################## + - name: Clean /var/lib/docker-puppet/docker-puppet-tasks*.json files + file: + path: "{{item}}" + state: absent + with_fileglob: + - /var/lib/docker-puppet/docker-puppet-tasks*.json + when: deploy_server_id == bootstrap_server_id - name: Write docker-puppet-tasks json files copy: content="{{item.value|to_json}}" dest=/var/lib/docker-puppet/docker-puppet-tasks{{item.key.replace("step_", "")}}.json force=yes with_dict: "{{docker_puppet_tasks}}" @@ -232,33 +223,6 @@ resources: servers: {get_param: [servers, {{role.name}}]} config: {get_resource: {{role.name}}HostPrepConfig} - {{role.name}}PuppetStepConfig: - type: OS::Heat::Value - properties: - type: string - value: - yaql: - expression: - # select 'step_config' only from services that do not have a docker_config - $.data.service_names.zip($.data.step_config, $.data.docker_config).where($[2] = null).where($[1] != null).select($[1]).join("\n") - data: - service_names: {get_param: [role_data, {{role.name}}, service_names]} - step_config: {get_param: [role_data, {{role.name}}, step_config]} - docker_config: {get_param: [role_data, {{role.name}}, docker_config]} - - {{role.name}}DockerConfig: - type: OS::Heat::Value - properties: - type: json - value: - yaql: - expression: - # select 'docker_config' only from services that have it - $.data.service_names.zip($.data.docker_config).where($[1] != null).select($[1]).reduce($1.mergeWith($2), {}) - data: - service_names: {get_param: [role_data, {{role.name}}, service_names]} - docker_config: {get_param: [role_data, {{role.name}}, docker_config]} - # BEGIN CONFIG STEPS {{role.name}}PreConfig: @@ -270,7 +234,6 @@ resources: update_identifier: {get_param: DeployIdentifier} {% for step in range(1, deploy_steps_max) %} - {{role.name}}Deployment_Step{{step}}: type: OS::Heat::StructuredDeploymentGroup depends_on: @@ -280,16 +243,16 @@ resources: # WorkflowTasks_StepX resource and can be remove # if https://bugs.launchpad.net/heat/+bug/1700569 # is fixed. - {% if step == 1 %} - {% for dep in roles %} + {%- if step == 1 %} + {%- for dep in roles %} - {{dep.name}}PreConfig - {{dep.name}}ArtifactsDeploy - {% endfor %} - {% else %} - {% for dep in roles %} + {%- endfor %} + {%- else %} + {%- for dep in roles %} - {{dep.name}}Deployment_Step{{step -1}} - {% endfor %} - {% endif %} + {%- endfor %} + {%- endif %} properties: name: {{role.name}}Deployment_Step{{step}} servers: {get_param: [servers, {{role.name}}]} @@ -300,7 +263,6 @@ resources: update_identifier: {get_param: DeployIdentifier} bootstrap_server_id: {get_param: [servers, {{primary_role_name}}, '0']} docker_puppet_debug: {get_param: DockerPuppetDebug} - {% endfor %} # END CONFIG STEPS @@ -309,9 +271,9 @@ resources: # after all the previous deployment steps. {{role.name}}ExtraConfigPost: depends_on: - {% for dep in roles %} + {%- for dep in roles %} - {{dep.name}}Deployment_Step5 - {% endfor %} + {%- endfor %} type: OS::TripleO::NodeExtraConfigPost properties: servers: {get_param: [servers, {{role.name}}]} @@ -322,9 +284,9 @@ resources: {{role.name}}PostConfig: type: OS::TripleO::Tasks::{{role.name}}PostConfig depends_on: - {% for dep in roles %} + {%- for dep in roles %} - {{dep.name}}ExtraConfigPost - {% endfor %} + {%- endfor %} properties: servers: {get_param: servers} input_values: |