Split out hosts config deployment

This patch moves the hosts configuration into its own deployment.
It will continue to use os-apply-config as something that is
required early on in the bootstrapping (it needs to be
configured before puppet runs for example).

The motivation here is so we can refactor all-nodes-config.yaml to use a
new hiera hook that that avoids os-apply-config entirely.

Change-Id: Ib3e4380f205358b27d22a1102b663cf300b1ed86
Partial-bug: #1596373
(cherry picked from commit 9f8944111c)
This commit is contained in:
Dan Prince 2016-10-10 21:03:12 -04:00 committed by Emilien Macchi
parent 8c873b650e
commit 232e62762e
4 changed files with 54 additions and 19 deletions

30
hosts-config.yaml Normal file
View File

@ -0,0 +1,30 @@
heat_template_version: 2016-10-14
description: 'All Hosts Config'
parameters:
hosts:
type: comma_delimited_list
resources:
hostsConfigImpl:
type: OS::Heat::StructuredConfig
properties:
group: os-apply-config
config:
hosts:
list_join:
- "\n"
- {get_param: hosts}
outputs:
config_id:
description: The ID of the hostsConfigImpl resource.
value:
{get_resource: hostsConfigImpl}
hosts_entries:
description: |
The content that should be appended to your /etc/hosts if you want to get
hostname-based access to the deployed nodes (useful for testing without
setting up a DNS).
value: {get_attr: [hostsConfigImpl, config, hosts]}

View File

@ -3,6 +3,7 @@ resource_registry:
OS::TripleO::SoftwareDeployment: OS::Heat::StructuredDeployment OS::TripleO::SoftwareDeployment: OS::Heat::StructuredDeployment
OS::TripleO::PostDeploySteps: puppet/post.yaml OS::TripleO::PostDeploySteps: puppet/post.yaml
OS::TripleO::AllNodes::SoftwareConfig: puppet/all-nodes-config.yaml OS::TripleO::AllNodes::SoftwareConfig: puppet/all-nodes-config.yaml
OS::TripleO::Hosts::SoftwareConfig: hosts-config.yaml
OS::TripleO::DefaultPasswords: default_passwords.yaml OS::TripleO::DefaultPasswords: default_passwords.yaml
# Tasks (for internal TripleO usage) # Tasks (for internal TripleO usage)

View File

@ -214,8 +214,16 @@ resources:
EndpointMap: {get_attr: [EndpointMap, endpoint_map]} EndpointMap: {get_attr: [EndpointMap, endpoint_map]}
DefaultPasswords: {get_attr: [DefaultPasswords, passwords]} DefaultPasswords: {get_attr: [DefaultPasswords, passwords]}
{{role.name}}HostsDeployment:
type: OS::Heat::StructuredDeployments
properties:
name: {{role.name}}HostsDeployment
config: {get_attr: [hostsConfig, config_id]}
servers: {get_attr: [{{role.name}}, attributes, nova_server_resource]}
{{role.name}}AllNodesDeployment: {{role.name}}AllNodesDeployment:
type: OS::Heat::StructuredDeployments type: OS::Heat::StructuredDeployments
depends_on: {{role.name}}HostsDeployment
properties: properties:
name: {{role.name}}AllNodesDeployment name: {{role.name}}AllNodesDeployment
config: {get_attr: [allNodesConfig, config_id]} config: {get_attr: [allNodesConfig, config_id]}
@ -303,6 +311,16 @@ resources:
MonitoringSubscriptions: {get_attr: [{{role.name}}ServiceChain, role_data, monitoring_subscriptions]} MonitoringSubscriptions: {get_attr: [{{role.name}}ServiceChain, role_data, monitoring_subscriptions]}
{% endfor %} {% endfor %}
hostsConfig:
type: OS::TripleO::Hosts::SoftwareConfig
properties:
hosts:
{% for role in roles %}
- list_join:
- '\n'
- {get_attr: [{{role.name}}, hosts_entry]}
{% endfor %}
allNodesConfig: allNodesConfig:
type: OS::TripleO::AllNodes::SoftwareConfig type: OS::TripleO::AllNodes::SoftwareConfig
properties: properties:
@ -311,12 +329,6 @@ resources:
cloud_name_storage: {get_param: CloudNameStorage} cloud_name_storage: {get_param: CloudNameStorage}
cloud_name_storage_mgmt: {get_param: CloudNameStorageManagement} cloud_name_storage_mgmt: {get_param: CloudNameStorageManagement}
cloud_name_ctlplane: {get_param: CloudNameCtlplane} cloud_name_ctlplane: {get_param: CloudNameCtlplane}
hosts:
{% for role in roles %}
- list_join:
- '\n'
- {get_attr: [{{role.name}}, hosts_entry]}
{% endfor %}
enabled_services: enabled_services:
list_join: list_join:
- ',' - ','
@ -517,6 +529,10 @@ resources:
# Post deployment steps for all roles # Post deployment steps for all roles
AllNodesDeploySteps: AllNodesDeploySteps:
type: OS::TripleO::PostDeploySteps type: OS::TripleO::PostDeploySteps
{% for role in roles %}
depends_on:
- {{role.name}}AllNodesDeployment
{% endfor %}
properties: properties:
servers: servers:
{% for role in roles %} {% for role in roles %}
@ -599,7 +615,7 @@ outputs:
value: value:
list_join: list_join:
- "\n" - "\n"
- - {get_attr: [allNodesConfig, hosts_entries]} - - {get_attr: [hostsConfig, hosts_entries]}
- -
- str_replace: - str_replace:
template: IP HOST template: IP HOST

View File

@ -12,8 +12,6 @@ parameters:
type: string type: string
cloud_name_ctlplane: cloud_name_ctlplane:
type: string type: string
hosts:
type: comma_delimited_list
# FIXME(shardy) this can be comma_delimited_list when # FIXME(shardy) this can be comma_delimited_list when
# https://bugs.launchpad.net/heat/+bug/1617019 is fixed # https://bugs.launchpad.net/heat/+bug/1617019 is fixed
enabled_services: enabled_services:
@ -66,10 +64,6 @@ resources:
properties: properties:
group: os-apply-config group: os-apply-config
config: config:
hosts:
list_join:
- "\n"
- {get_param: hosts}
hiera: hiera:
datafiles: datafiles:
bootstrap_node: bootstrap_node:
@ -205,9 +199,3 @@ outputs:
description: The ID of the allNodesConfigImpl resource. description: The ID of the allNodesConfigImpl resource.
value: value:
{get_resource: allNodesConfigImpl} {get_resource: allNodesConfigImpl}
hosts_entries:
description: |
The content that should be appended to your /etc/hosts if you want to get
hostname-based access to the deployed nodes (useful for testing without
setting up a DNS).
value: {get_attr: [allNodesConfigImpl, config, hosts]}