From e115e14e539c87961139cf2c52edc1d1a6683019 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Fri, 31 May 2019 15:54:31 -0400 Subject: [PATCH] Use Ansible to configure the Hiera config Replace the Heat resources which used to manage the hiera config file and now use Ansible with the new tripleo-hieradata role. Remove {{server_resource_name}}Deployment and {{server_resource_name}}Config resources not needed anymore. Change-Id: I88fe3460af93b83cc086afeb1c2b959bbb720470 implements: blueprint reduce-deployment-resources Depends-On: Ia5f11ea1a2f16b736ed7053c5182c7f5a7eb1f4b --- common/deploy-steps.j2 | 7 ++++++ overcloud.j2.yaml | 33 ++++++++++++++++++++++++++++ puppet/role.role.j2.yaml | 47 ---------------------------------------- 3 files changed, 40 insertions(+), 47 deletions(-) diff --git a/common/deploy-steps.j2 b/common/deploy-steps.j2 index ff6b6a2bdd..2a1c4a3226 100644 --- a/common/deploy-steps.j2 +++ b/common/deploy-steps.j2 @@ -122,6 +122,9 @@ parameters: {{role.name}}DeploymentHieradata: type: json default: {} + {{role.name}}DeploymentHierarchy: + type: json + default: {} {{role.name}}PerHostHieradata: type: json default: {} @@ -405,6 +408,7 @@ outputs: hieradata_template: "{{role.name}}/all-nodes-deployment-hieradata.j2.yaml" hieradata_variable_start_string: $$ hieradata_variable_end_string: $$ + hieradata_files: "{{ '{{' }} lookup('file', '{{role.name}}/deployment-hierarchy.yaml') {{ '}}' }}" when: tripleo_role_name == '{{role.name}}' - name: Deployment hieradata include_role: @@ -413,6 +417,7 @@ outputs: hieradata_template: "{{role.name}}/deployment-hieradata.j2.yaml" hieradata_variable_start_string: $$ hieradata_variable_end_string: $$ + hieradata_files: "{{ '{{' }} lookup('file', '{{role.name}}/deployment-hierarchy.yaml') {{ '}}' }}" when: tripleo_role_name == '{{role.name}}' - name: Per-host hieradata include_role: @@ -422,6 +427,7 @@ outputs: hieradata_per_host: True hieradata_variable_start_string: $$ hieradata_variable_end_string: $$ + hieradata_files: "{{ '{{' }} lookup('file', '{{role.name}}/deployment-hierarchy.yaml') {{ '}}' }}" when: tripleo_role_name == '{{role.name}}' {%- endfor %} tags: @@ -679,6 +685,7 @@ outputs: # 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}}/deployment-hierarchy.yaml: {get_param: {{role.name}}DeploymentHierarchy} {{role.name}}/per-host-hieradata.j2.yaml: {get_param: {{role.name}}PerHostHieradata} {%- endfor %} update_steps_tasks: | diff --git a/overcloud.j2.yaml b/overcloud.j2.yaml index 61c625446b..0078d88517 100644 --- a/overcloud.j2.yaml +++ b/overcloud.j2.yaml @@ -1000,6 +1000,37 @@ resources: - {get_attr: [{{role.name}}, blacklist_hostname]} {%- endfor %} +{%- for role in roles %} + {{role.name}}ConfigHierarchy: + type: OS::Heat::Value + properties: + value: + - '"%{::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 +{%- endfor %} + # Post deployment steps for all roles AllNodesDeploySteps: type: OS::TripleO::PostDeploySteps @@ -1029,6 +1060,8 @@ resources: map_merge: list_concat: - {get_attr: [{{role.name}}, config_datafiles]} + {{role.name}}DeploymentHierarchy: + {get_attr: [{{role.name}}ConfigHierarchy, value]} {{role.name}}PerHostHieradata: map_merge: list_concat: diff --git a/puppet/role.role.j2.yaml b/puppet/role.role.j2.yaml index 559fb27ecf..c9380059b4 100644 --- a/puppet/role.role.j2.yaml +++ b/puppet/role.role.j2.yaml @@ -660,53 +660,6 @@ resources: - {get_param: {{role.name}}NetworkDeploymentActions} - {get_param: NetworkDeploymentActions} - {{server_resource_name}}Deployment: - type: OS::Heat::StructuredDeployment - depends_on: PreNetworkConfig - properties: - name: {{server_resource_name}}Deployment - config: {get_resource: {{server_resource_name}}Config} - server: {get_resource: {{server_resource_name}}} - actions: - if: - - server_not_blacklisted - - ['CREATE', 'UPDATE'] - - [] - - {{server_resource_name}}Config: - type: OS::Heat::StructuredConfig - depends_on: {{server_resource_name}}ConfigDatafiles - properties: - group: hiera - config: - 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: