Merge "Use Ansible for {{server_resource_name}}Deployment"

This commit is contained in:
Zuul 2019-06-22 01:26:35 +00:00 committed by Gerrit Code Review
commit 636cf458ab
3 changed files with 87 additions and 38 deletions

View File

@ -119,6 +119,12 @@ parameters:
{{role.name}}AllNodesDeploymentHieradata:
type: json
default: {}
{{role.name}}DeploymentHieradata:
type: json
default: {}
{{role.name}}PerHostHieradata:
type: json
default: {}
{%- endfor %}
ValidateControllersIcmp:
default: true
@ -400,6 +406,23 @@ outputs:
hieradata_variable_start_string: $$
hieradata_variable_end_string: $$
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 %}
tags:
- overcloud
@ -651,11 +674,12 @@ 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}
# TODO (slagle): temporarily write the path with a .yaml extension until
# https://review.opendev.org/#/c/663736 merges. Once merged, this can be
# removed.
{{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 %}
update_steps_tasks: |
{%- for role in roles %}

View File

@ -1025,6 +1025,14 @@ resources:
{%- for role in roles %}
{{role.name}}Count: {get_param: {{role.name}}Count}
{{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 %}
ServiceNetMapLower: {get_attr: [ServiceNetMap, service_net_map_lower]}
PingTestIpsMap:

View File

@ -675,11 +675,14 @@ resources:
{{server_resource_name}}Config:
type: OS::Heat::StructuredConfig
depends_on: {{server_resource_name}}ConfigDatafiles
properties:
group: hiera
config:
hierarchy:
map_merge:
- hierarchy:
- '"%{::uuid}"'
- host_extraconfig
- docker_puppet # Optionally provided by container-puppet.py
- heat_config_%{::deploy_config_name}
- config_step
@ -702,12 +705,17 @@ resources:
- cisco_aci_data # Optionally provided by Controller/ComputeExtraConfigPre
# Special variable for upgrade
- upgrade
merge_behavior: deeper
- merge_behavior: deeper
{{server_resource_name}}ConfigDatafiles:
type: OS::Heat::Value
properties:
value:
type: json
datafiles:
service_names:
service_names: {get_param: ServiceNames}
sensu::subscriptions: {get_param: MonitoringSubscriptions}
net_ip_map: {get_attr: [NetIpMap, net_ip_map]}
service_configs: {get_param: ServiceConfigSettings}
{{role.name.lower()}}_extraconfig:
map_merge:
@ -718,13 +726,6 @@ resources:
extraconfig: {get_param: ExtraConfig}
{{role.name.lower()}}:
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
NodeTLSCAData:
@ -735,7 +736,6 @@ resources:
# Hook for site-specific additional pre-deployment config, e.g extra hieradata
{{role.name}}ExtraConfigPre:
depends_on: {{server_resource_name}}Deployment
type: OS::TripleO::{{role.name}}ExtraConfigPre
# We have to use conditions here so that we don't break backwards
# compatibility with templates everywhere
@ -767,7 +767,6 @@ resources:
SshHostPubKey:
type: OS::TripleO::Ssh::HostPubKey
depends_on: {{server_resource_name}}Deployment
properties:
server: {get_resource: {{server_resource_name}}}
deployment_actions: {get_attr: [DeploymentActions, value]}
@ -803,8 +802,6 @@ resources:
properties:
type: json
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 %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
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_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:
ansible_host_vars_map:
@ -825,6 +831,17 @@ outputs:
- host: {get_attr: [{{server_resource_name}}AnsibleHostVars, value]}
- keys:
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:
description: IP address of the server in the ctlplane network
value: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]}