Merge "Use ansible for AllNodesDeployment"

This commit is contained in:
Zuul 2019-06-06 02:19:25 +00:00 committed by Gerrit Code Review
commit b5cf51665d
4 changed files with 75 additions and 37 deletions

View File

@ -115,6 +115,11 @@ parameters:
description: Mapping of service name to network name
type: json
default: {}
{%- for role in roles %}
{{role.name}}AllNodesDeploymentHieradata:
type: json
default: {}
{%- endfor %}
conditions:
{% for role in enabled_roles %}
@ -348,6 +353,25 @@ outputs:
- deploy_steps
- step0
- hosts: {{primary_role_name}}:DEPLOY_TARGET_HOST
name: Server pre deployment steps
gather_facts: no
any_errors_fatal: yes
tasks:
{%- for role in roles %}
- name: AllNodesDeployment hieradata
include_role:
name: tripleo-hieradata
vars:
hieradata_template: "{{role.name}}/all-nodes-deployment-hieradata.j2.yaml"
hieradata_variable_start_string: $$
hieradata_variable_end_string: $$
when: tripleo_role_name == '{{role.name}}'
{%- endfor %}
tags:
- overcloud
- pre_deploy_steps
- hosts: {{primary_role_name}}:DEPLOY_TARGET_HOST
name: Server deployments
gather_facts: no
@ -514,6 +538,9 @@ outputs:
external_deploy_steps_tasks: {get_attr: [ExternalDeployTasks, value]}
external_post_deploy_steps_tasks: {get_attr: [ExternalPostDeployTasks, value]}
{%- for role in roles %}
{{role.name}}/all-nodes-deployment-hieradata.j2: {get_param: {{role.name}}AllNodesDeploymentHieradata}
{%- endfor %}
update_steps_tasks: |
{%- for role in roles %}
- import_tasks: {{role.name}}/update_tasks.yaml

View File

@ -5,7 +5,7 @@ resource_registry:
OS::Heat::StructuredDeployment: config-download-structured.yaml
OS::TripleO::PostDeploySteps: common/post.yaml
OS::TripleO::AllNodes::SoftwareConfig: puppet/all-nodes-config.yaml
OS::TripleO::AllNodesDeployment: OS::Heat::StructuredDeployments
OS::TripleO::AllNodesDeployment: OS::Heat::None
OS::TripleO::Hosts::SoftwareConfig: hosts-config.yaml
OS::TripleO::Ssh::HostPubKey: OS::Heat::None
OS::TripleO::Ssh::KnownHostsConfig: extraconfig/tasks/ssh/known_hosts_config.yaml

View File

@ -584,18 +584,8 @@ resources:
{%- endfor %}
properties:
name: {{role.name}}AllNodesDeployment
config: {get_attr: [allNodesConfig, config_id]}
config: {get_attr: [{{role.name}}allNodesConfig, config_id]}
servers: {get_attr: [{{role.name}}Servers, value]}
input_values:
# Note we have to use yaql to look up the first hostname/ip in the
# list because heat path based attributes operate on the attribute
# inside the ResourceGroup, not the exposed list ref discussion in
# https://bugs.launchpad.net/heat/+bug/1640488
# The coalesce is needed because $.data is None during heat validation
bootstrap_nodeid:
yaql:
expression: coalesce($.data, []).first(null)
data: {get_attr: [{{role.name}}, hostname]}
{{role.name}}AllNodesValidationDeployment:
type: OS::Heat::StructuredDeployments
@ -758,7 +748,8 @@ resources:
{%- endfor %}
- {get_param: ExtraHostFileEntries}
allNodesConfig:
{%- for outer_role in roles %}
{{outer_role.name}}allNodesConfig:
type: OS::TripleO::AllNodes::SoftwareConfig
properties:
{%- for network in networks if network.vip|default(false) and network.enabled|default(true) %}
@ -826,6 +817,11 @@ resources:
ServiceNetMap: {get_attr: [ServiceNetMap, service_net_map_lower]}
DeployIdentifier: {get_param: DeployIdentifier}
UpdateIdentifier: {get_param: UpdateIdentifier}
bootstrap_nodeid:
yaql:
expression: coalesce($.data, []).first(null)
data: {get_attr: [{{outer_role.name}}, hostname]}
{%- endfor %}
GlobalConfig:
type: OS::Heat::Value
@ -1036,6 +1032,7 @@ resources:
ssh_known_hosts_hostnames: {get_attr: [SshKnownHostsHostnames, value]}
{%- for role in roles %}
{{role.name}}Count: {get_param: {{role.name}}Count}
{{role.name}}AllNodesDeploymentHieradata: {get_attr: [{{role.name}}allNodesConfig, all_nodes_config_hieradata]}
{%- endfor %}
ServiceNetMapLower: {get_attr: [ServiceNetMap, service_net_map_lower]}
@ -1177,9 +1174,11 @@ outputs:
BlacklistedIpAddresses:
description: List of blacklisted ctlplane IP addresses
value: {get_attr: [BlacklistedIpAddresses, value]}
# We can use the AllNodesConfig from the primary role here as this part of
# the allNodesConfig is the same for all roles.
AllNodesConfig:
description: The config (hieradata) for all nodes.
value: {get_attr: [allNodesConfig, all_nodes_config]}
value: {get_attr: [{{primary_role_name}}allNodesConfig, all_nodes_config]}
GlobalConfig:
description: The global_config (hieradata).
value: {get_attr: [GlobalConfig, value]}

View File

@ -82,6 +82,9 @@ parameters:
description: CLI tool used to manage containers.
constraints:
- allowed_values: ['docker', 'podman']
bootstrap_nodeid:
type: string
default: ''
resources:
@ -155,14 +158,13 @@ resources:
stack_update_type: {get_param: StackUpdateType}
container_cli: {get_param: ContainerCli}
allNodesConfigImpl:
type: OS::Heat::StructuredConfig
allNodesConfigDatafiles:
type: OS::Heat::Value
properties:
group: hiera
config:
value:
datafiles:
bootstrap_node:
bootstrap_nodeid: {get_input: bootstrap_nodeid}
bootstrap_nodeid: {get_param: bootstrap_nodeid}
all_nodes: {get_attr: [allNodesConfigValue, value]}
vip_data:
map_merge:
@ -240,6 +242,12 @@ resources:
cloud_name_ctlplane: {get_param: cloud_name_ctlplane}
enable_internal_tls: {get_param: EnableInternalTLS}
allNodesConfigImpl:
type: OS::Heat::StructuredConfig
properties:
group: hiera
config: {get_attr: [allNodesConfigDatafiles, value]}
outputs:
config_id:
description: The ID of the allNodesConfigImpl resource.
@ -248,3 +256,7 @@ outputs:
all_nodes_config:
description: The all_nodes hieradata config
value: {get_attr: [allNodesConfigValue, value]}
all_nodes_config_hieradata:
description: The all_nodes config in the full format with datafiles section.
value: {get_attr: [allNodesConfigDatafiles, value]}