Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Merge "Use Ansible for {{server_resource_name}}Deployment"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and openstack-gerrit committed Jun 22, 2019
2 parents eb2e7e4 + cb767a9 commit 636cf45
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 38 deletions.
26 changes: 25 additions & 1 deletion common/deploy-steps.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 %}
Expand Down
8 changes: 8 additions & 0 deletions overcloud.j2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
91 changes: 54 additions & 37 deletions puppet/role.role.j2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -675,39 +675,47 @@ resources:

{{server_resource_name}}Config:
type: OS::Heat::StructuredConfig
depends_on: {{server_resource_name}}ConfigDatafiles
properties:
group: hiera
config:
hierarchy:
- '"%{::uuid}"'
- docker_puppet # Optionally provided by container-puppet.py
- heat_config_%{::deploy_config_name}
- config_step
- {{role.name.lower()}}_extraconfig
- extraconfig
- service_names
- service_configs
- {{role.name.lower()}}
- bootstrap_node # provided by allNodesConfig
- all_nodes # provided by allNodesConfig
- vip_data # provided by allNodesConfig
- net_ip_map
- '"%{::osfamily}"'
# The following are required for compatibility with the Controller role
# where some vendor integrations added hieradata via ExtraConfigPre
- neutron_bigswitch_data # Optionally provided by Controller/ComputeExtraConfigPre
- neutron_cisco_data # Optionally provided by Controller/ComputeExtraConfigPre
- cisco_n1kv_data # Optionally provided by Controller/ComputeExtraConfigPre
- midonet_data #Optionally provided by AllNodesExtraConfig
- cisco_aci_data # Optionally provided by Controller/ComputeExtraConfigPre
# Special variable for upgrade
- upgrade
merge_behavior: deeper
map_merge:
- hierarchy:
- '"%{::uuid}"'
- host_extraconfig
- docker_puppet # Optionally provided by container-puppet.py
- heat_config_%{::deploy_config_name}
- config_step
- {{role.name.lower()}}_extraconfig
- extraconfig
- service_names
- service_configs
- {{role.name.lower()}}
- bootstrap_node # provided by allNodesConfig
- all_nodes # provided by allNodesConfig
- vip_data # provided by allNodesConfig
- net_ip_map
- '"%{::osfamily}"'
# The following are required for compatibility with the Controller role
# where some vendor integrations added hieradata via ExtraConfigPre
- neutron_bigswitch_data # Optionally provided by Controller/ComputeExtraConfigPre
- neutron_cisco_data # Optionally provided by Controller/ComputeExtraConfigPre
- cisco_n1kv_data # Optionally provided by Controller/ComputeExtraConfigPre
- midonet_data #Optionally provided by AllNodesExtraConfig
- cisco_aci_data # Optionally provided by Controller/ComputeExtraConfigPre
# Special variable for upgrade
- upgrade
- 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:
Expand All @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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]}
Expand Down Expand Up @@ -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]}
Expand All @@ -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:
Expand All @@ -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]}
Expand Down

0 comments on commit 636cf45

Please sign in to comment.