Use ansible for AllNodesDeployment

Replaces the SoftwareDeployment resource for AllNodesDeployment with the
usage of the new tripleo-hieradata role.

Change-Id: Ic174699ef038ca3028c21a49373658a5d43844f6
Depends-On: I28b5c2bedbba1c27da628c6bda4c7a57ca0f3ad7
implements: blueprint reduce-deployment-resources
This commit is contained in:
James Slagle 2019-05-14 15:34:31 -04:00 committed by Emilien Macchi
parent 1c4304aeac
commit 9be6c1c935
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:
@ -194,52 +196,58 @@ resources:
get_param: [NetVipMap, {get_param: [ServiceNetMap, keystone_admin_api_network]}]
keystone_public_api_vip:
get_param: [NetVipMap, {get_param: [ServiceNetMap, keystone_public_api_network]}]
{%- if 'External' in _networks %}
{%- if 'External' in _networks %}
public_virtual_ip: {get_param: [NetVipMap, {get_param: ExternalNetName}]}
{%- else %}
{%- else %}
public_virtual_ip: {get_param: [NetVipMap, ctlplane]}
{%- endif %}
{%- endif %}
controller_virtual_ip: {get_param: [NetVipMap, ctlplane]}
{%- if 'InternalApi' in _networks %}
{%- if 'InternalApi' in _networks %}
# the internal_api_virtual_ip is needed for contrail only
internal_api_virtual_ip: {get_param: [NetVipMap, {get_param: InternalApiNetName}]}
{%- endif %}
{%- endif %}
network_virtual_ips:
ctlplane:
ip_address: {get_param: [NetVipMap, ctlplane]}
index: 1
{%- for network in networks if network.vip|default(false) and network.enabled|default(true) %}
# External virtual ip is currently being handled separately as public_virtual_ip.
# Likewise, optional StorageNFS virtual ip is handled separately as ganesha_vip.
{%- if network.name != 'External' and network.name != 'StorageNFS' %}
{%- for network in networks if network.vip|default(false) and network.enabled|default(true) %}
# External virtual ip is currently being handled separately as public_virtual_ip.
# Likewise, optional StorageNFS virtual ip is handled separately as ganesha_vip.
{%- if network.name != 'External' and network.name != 'StorageNFS' %}
{{network.name_lower}}:
ip_address: {get_param: [NetVipMap, {get_param: {{network.name}}NetName}]}
index: {{loop.index + 1}}
{%- endif %}
{%- endfor %}
{%- endif %}
{%- endfor %}
redis_vip: {get_param: RedisVirtualIP}
{%- for network in networks if network.name == 'StorageNFS' and network.enabled|default(true) %}
{%- for network in networks if network.name == 'StorageNFS' and network.enabled|default(true) %}
ganesha_vip: {get_param: [NetVipMap, {get_param: StorageNFSNetName}]}
{%- endfor %}
{%- endfor %}
# public_virtual_ip and controller_virtual_ip are needed in
# both HAproxy & keepalived.
{%- if 'External' in _networks %}
{%- if 'External' in _networks %}
tripleo::haproxy::public_virtual_ip: {get_param: [NetVipMap, {get_param: ExternalNetName}]}
tripleo::keepalived::public_virtual_ip: {get_param: [NetVipMap, {get_param: ExternalNetName}]}
{%- else %}
{%- else %}
tripleo::haproxy::public_virtual_ip: {get_param: [NetVipMap, ctlplane]}
tripleo::keepalived::public_virtual_ip: {get_param: [NetVipMap, ctlplane]}
{%- endif %}
{%- endif %}
tripleo::haproxy::controller_virtual_ip: {get_param: [NetVipMap, ctlplane]}
tripleo::keepalived::controller_virtual_ip: {get_param: [NetVipMap, ctlplane]}
tripleo::keepalived::redis_virtual_ip: {get_param: RedisVirtualIP}
tripleo::redis_notification::haproxy_monitor_ip: {get_param: [NetVipMap, ctlplane]}
{%- for network in networks if network.vip|default(false) and network.enabled|default(true) %}
{%- for network in networks if network.vip|default(false) and network.enabled|default(true) %}
cloud_name_{{network.name_lower}}: {get_param: cloud_name_{{network.name_lower}}}
{%- endfor %}
{%- endfor %}
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]}