Use Ansible for {{server_resource_name}}Deployment

Use the new tripleo-hieradata Ansible role to configure
the remaining Hieradata files that were created by Heat before.

{{server_resource_name}} isn't yet fully converted to Ansible, and
another patch will remove the resource when Ansible controls the
hiera.yaml file in /etc/puppet/hieradata.

Change-Id: Ib946b566d66300d23e7abc12498cc11d3f5fa5f8
implements: blueprint reduce-deployment-resources
This commit is contained in:
Emilien Macchi 2019-06-04 15:39:33 -04:00 committed by James Slagle
parent b546b425f9
commit cb767a97b9
3 changed files with 87 additions and 38 deletions

View File

@ -119,6 +119,12 @@ parameters:
{{role.name}}AllNodesDeploymentHieradata: {{role.name}}AllNodesDeploymentHieradata:
type: json type: json
default: {} default: {}
{{role.name}}DeploymentHieradata:
type: json
default: {}
{{role.name}}PerHostHieradata:
type: json
default: {}
{%- endfor %} {%- endfor %}
ValidateControllersIcmp: ValidateControllersIcmp:
default: true default: true
@ -400,6 +406,23 @@ outputs:
hieradata_variable_start_string: $$ hieradata_variable_start_string: $$
hieradata_variable_end_string: $$ hieradata_variable_end_string: $$
when: tripleo_role_name == '{{role.name}}' when: tripleo_role_name == '{{role.name}}'
- name: Deployment hieradata
include_role:
name: tripleo-hieradata
vars:
hieradata_template: "{{role.name}}/deployment-hieradata.j2.yaml"
hieradata_variable_start_string: $$
hieradata_variable_end_string: $$
when: tripleo_role_name == '{{role.name}}'
- name: Per-host hieradata
include_role:
name: tripleo-hieradata
vars:
hieradata_template: "{{role.name}}/per-host-hieradata.j2.yaml"
hieradata_per_host: True
hieradata_variable_start_string: $$
hieradata_variable_end_string: $$
when: tripleo_role_name == '{{role.name}}'
{%- endfor %} {%- endfor %}
tags: tags:
- overcloud - overcloud
@ -651,11 +674,12 @@ 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]}
{%- for role in roles %} {%- for role in roles %}
{{role.name}}/all-nodes-deployment-hieradata.j2: {get_param: {{role.name}}AllNodesDeploymentHieradata}
# TODO (slagle): temporarily write the path with a .yaml extension until # TODO (slagle): temporarily write the path with a .yaml extension until
# https://review.opendev.org/#/c/663736 merges. Once merged, this can be # https://review.opendev.org/#/c/663736 merges. Once merged, this can be
# removed. # removed.
{{role.name}}/all-nodes-deployment-hieradata.j2.yaml: {get_param: {{role.name}}AllNodesDeploymentHieradata} {{role.name}}/all-nodes-deployment-hieradata.j2.yaml: {get_param: {{role.name}}AllNodesDeploymentHieradata}
{{role.name}}/deployment-hieradata.j2.yaml: {get_param: {{role.name}}DeploymentHieradata}
{{role.name}}/per-host-hieradata.j2.yaml: {get_param: {{role.name}}PerHostHieradata}
{%- endfor %} {%- endfor %}
update_steps_tasks: | update_steps_tasks: |
{%- for role in roles %} {%- for role in roles %}

View File

@ -1025,6 +1025,14 @@ resources:
{%- for role in roles %} {%- for role in roles %}
{{role.name}}Count: {get_param: {{role.name}}Count} {{role.name}}Count: {get_param: {{role.name}}Count}
{{role.name}}AllNodesDeploymentHieradata: {get_attr: [{{role.name}}allNodesConfig, all_nodes_config_hieradata]} {{role.name}}AllNodesDeploymentHieradata: {get_attr: [{{role.name}}allNodesConfig, all_nodes_config_hieradata]}
{{role.name}}DeploymentHieradata:
map_merge:
list_concat:
- {get_attr: [{{role.name}}, config_datafiles]}
{{role.name}}PerHostHieradata:
map_merge:
list_concat:
- {get_attr: [{{role.name}}, per_host_hieradata_map]}
{%- endfor %} {%- endfor %}
ServiceNetMapLower: {get_attr: [ServiceNetMap, service_net_map_lower]} ServiceNetMapLower: {get_attr: [ServiceNetMap, service_net_map_lower]}
PingTestIpsMap: PingTestIpsMap:

View File

@ -675,39 +675,47 @@ resources:
{{server_resource_name}}Config: {{server_resource_name}}Config:
type: OS::Heat::StructuredConfig type: OS::Heat::StructuredConfig
depends_on: {{server_resource_name}}ConfigDatafiles
properties: properties:
group: hiera group: hiera
config: config:
hierarchy: map_merge:
- '"%{::uuid}"' - hierarchy:
- docker_puppet # Optionally provided by container-puppet.py - '"%{::uuid}"'
- heat_config_%{::deploy_config_name} - host_extraconfig
- config_step - docker_puppet # Optionally provided by container-puppet.py
- {{role.name.lower()}}_extraconfig - heat_config_%{::deploy_config_name}
- extraconfig - config_step
- service_names - {{role.name.lower()}}_extraconfig
- service_configs - extraconfig
- {{role.name.lower()}} - service_names
- bootstrap_node # provided by allNodesConfig - service_configs
- all_nodes # provided by allNodesConfig - {{role.name.lower()}}
- vip_data # provided by allNodesConfig - bootstrap_node # provided by allNodesConfig
- net_ip_map - all_nodes # provided by allNodesConfig
- '"%{::osfamily}"' - vip_data # provided by allNodesConfig
# The following are required for compatibility with the Controller role - net_ip_map
# where some vendor integrations added hieradata via ExtraConfigPre - '"%{::osfamily}"'
- neutron_bigswitch_data # Optionally provided by Controller/ComputeExtraConfigPre # The following are required for compatibility with the Controller role
- neutron_cisco_data # Optionally provided by Controller/ComputeExtraConfigPre # where some vendor integrations added hieradata via ExtraConfigPre
- cisco_n1kv_data # Optionally provided by Controller/ComputeExtraConfigPre - neutron_bigswitch_data # Optionally provided by Controller/ComputeExtraConfigPre
- midonet_data #Optionally provided by AllNodesExtraConfig - neutron_cisco_data # Optionally provided by Controller/ComputeExtraConfigPre
- cisco_aci_data # Optionally provided by Controller/ComputeExtraConfigPre - cisco_n1kv_data # Optionally provided by Controller/ComputeExtraConfigPre
# Special variable for upgrade - midonet_data #Optionally provided by AllNodesExtraConfig
- upgrade - cisco_aci_data # Optionally provided by Controller/ComputeExtraConfigPre
merge_behavior: deeper # Special variable for upgrade
- upgrade
- merge_behavior: deeper
{{server_resource_name}}ConfigDatafiles:
type: OS::Heat::Value
properties:
value:
type: json
datafiles: datafiles:
service_names: service_names:
service_names: {get_param: ServiceNames} service_names: {get_param: ServiceNames}
sensu::subscriptions: {get_param: MonitoringSubscriptions} sensu::subscriptions: {get_param: MonitoringSubscriptions}
net_ip_map: {get_attr: [NetIpMap, net_ip_map]}
service_configs: {get_param: ServiceConfigSettings} service_configs: {get_param: ServiceConfigSettings}
{{role.name.lower()}}_extraconfig: {{role.name.lower()}}_extraconfig:
map_merge: map_merge:
@ -718,13 +726,6 @@ resources:
extraconfig: {get_param: ExtraConfig} extraconfig: {get_param: ExtraConfig}
{{role.name.lower()}}: {{role.name.lower()}}:
tripleo::clouddomain: {get_param: CloudDomain} tripleo::clouddomain: {get_param: CloudDomain}
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
fqdn_{{network.name_lower}}: {get_attr: [NetHostMap, value, {{network.name_lower}}, fqdn]}
{%- endif %}
{%- endfor %}
fqdn_ctlplane: {get_attr: [NetHostMap, value, ctlplane, fqdn]}
fqdn_canonical: {get_attr: [NetHostMap, value, canonical, fqdn]}
# Resource for site-specific injection of root certificate # Resource for site-specific injection of root certificate
NodeTLSCAData: NodeTLSCAData:
@ -735,7 +736,6 @@ resources:
# Hook for site-specific additional pre-deployment config, e.g extra hieradata # Hook for site-specific additional pre-deployment config, e.g extra hieradata
{{role.name}}ExtraConfigPre: {{role.name}}ExtraConfigPre:
depends_on: {{server_resource_name}}Deployment
type: OS::TripleO::{{role.name}}ExtraConfigPre type: OS::TripleO::{{role.name}}ExtraConfigPre
# We have to use conditions here so that we don't break backwards # We have to use conditions here so that we don't break backwards
# compatibility with templates everywhere # compatibility with templates everywhere
@ -767,7 +767,6 @@ resources:
SshHostPubKey: SshHostPubKey:
type: OS::TripleO::Ssh::HostPubKey type: OS::TripleO::Ssh::HostPubKey
depends_on: {{server_resource_name}}Deployment
properties: properties:
server: {get_resource: {{server_resource_name}}} server: {get_resource: {{server_resource_name}}}
deployment_actions: {get_attr: [DeploymentActions, value]} deployment_actions: {get_attr: [DeploymentActions, value]}
@ -803,8 +802,6 @@ resources:
properties: properties:
type: json type: json
value: value:
# These variables aren't used anywhere yet but it's a base so later we can use it to
# build the per-host hieradata.
{%- for network in networks %} {%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %} {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
fqdn_{{network.name_lower}}: {get_attr: [NetHostMap, value, {{network.name_lower}}, fqdn]} fqdn_{{network.name_lower}}: {get_attr: [NetHostMap, value, {{network.name_lower}}, fqdn]}
@ -813,6 +810,15 @@ resources:
fqdn_ctlplane: {get_attr: [NetHostMap, value, ctlplane, fqdn]} fqdn_ctlplane: {get_attr: [NetHostMap, value, ctlplane, fqdn]}
fqdn_canonical: {get_attr: [NetHostMap, value, canonical, fqdn]} fqdn_canonical: {get_attr: [NetHostMap, value, canonical, fqdn]}
{{server_resource_name}}PerHostHieradata:
type: OS::Heat::Value
properties:
type: json
value:
datafiles:
host_extraconfig: {get_attr: [{{server_resource_name}}AnsibleHostVars, value]}
net_ip_map: {get_attr: [NetIpMap, net_ip_map]}
outputs: outputs:
ansible_host_vars_map: ansible_host_vars_map:
@ -825,6 +831,17 @@ outputs:
- host: {get_attr: [{{server_resource_name}}AnsibleHostVars, value]} - host: {get_attr: [{{server_resource_name}}AnsibleHostVars, value]}
- keys: - keys:
host: {get_attr: [{{server_resource_name}}, name]} host: {get_attr: [{{server_resource_name}}, name]}
per_host_hieradata_map:
description: |
Map of Hieradata specific per host.
value:
map_replace:
- host: {get_attr: [{{server_resource_name}}PerHostHieradata, value]}
- keys:
host: {get_attr: [{{server_resource_name}}, name]}
config_datafiles:
description: The config in the full format with datafiles section.
value: {get_attr: [{{server_resource_name}}ConfigDatafiles, value]}
ip_address: ip_address:
description: IP address of the server in the ctlplane network description: IP address of the server in the ctlplane network
value: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]} value: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]}