Browse Source

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)
tags/5.1.0
Dan Prince 2 years ago
parent
commit
232e62762e
4 changed files with 54 additions and 19 deletions
  1. 30
    0
      hosts-config.yaml
  2. 1
    0
      overcloud-resource-registry-puppet.j2.yaml
  3. 23
    7
      overcloud.j2.yaml
  4. 0
    12
      puppet/all-nodes-config.yaml

+ 30
- 0
hosts-config.yaml View File

@@ -0,0 +1,30 @@
1
+heat_template_version: 2016-10-14
2
+description: 'All Hosts Config'
3
+
4
+parameters:
5
+  hosts:
6
+    type: comma_delimited_list
7
+
8
+resources:
9
+
10
+  hostsConfigImpl:
11
+    type: OS::Heat::StructuredConfig
12
+    properties:
13
+      group: os-apply-config
14
+      config:
15
+        hosts:
16
+          list_join:
17
+          - "\n"
18
+          - {get_param: hosts}
19
+
20
+outputs:
21
+  config_id:
22
+    description: The ID of the hostsConfigImpl resource.
23
+    value:
24
+      {get_resource: hostsConfigImpl}
25
+  hosts_entries:
26
+    description: |
27
+      The content that should be appended to your /etc/hosts if you want to get
28
+      hostname-based access to the deployed nodes (useful for testing without
29
+      setting up a DNS).
30
+    value: {get_attr: [hostsConfigImpl, config, hosts]}

+ 1
- 0
overcloud-resource-registry-puppet.j2.yaml View File

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

+ 23
- 7
overcloud.j2.yaml View File

@@ -214,8 +214,16 @@ resources:
214 214
       EndpointMap: {get_attr: [EndpointMap, endpoint_map]}
215 215
       DefaultPasswords: {get_attr: [DefaultPasswords, passwords]}
216 216
 
217
+  {{role.name}}HostsDeployment:
218
+    type: OS::Heat::StructuredDeployments
219
+    properties:
220
+      name: {{role.name}}HostsDeployment
221
+      config: {get_attr: [hostsConfig, config_id]}
222
+      servers: {get_attr: [{{role.name}}, attributes, nova_server_resource]}
223
+
217 224
   {{role.name}}AllNodesDeployment:
218 225
     type: OS::Heat::StructuredDeployments
226
+    depends_on: {{role.name}}HostsDeployment
219 227
     properties:
220 228
       name: {{role.name}}AllNodesDeployment
221 229
       config: {get_attr: [allNodesConfig, config_id]}
@@ -303,6 +311,16 @@ resources:
303 311
           MonitoringSubscriptions: {get_attr: [{{role.name}}ServiceChain, role_data, monitoring_subscriptions]}
304 312
 {% endfor %}
305 313
 
314
+  hostsConfig:
315
+    type: OS::TripleO::Hosts::SoftwareConfig
316
+    properties:
317
+      hosts:
318
+{% for role in roles %}
319
+        - list_join:
320
+            - '\n'
321
+            - {get_attr: [{{role.name}}, hosts_entry]}
322
+{% endfor %}
323
+
306 324
   allNodesConfig:
307 325
     type: OS::TripleO::AllNodes::SoftwareConfig
308 326
     properties:
@@ -311,12 +329,6 @@ resources:
311 329
       cloud_name_storage: {get_param: CloudNameStorage}
312 330
       cloud_name_storage_mgmt: {get_param: CloudNameStorageManagement}
313 331
       cloud_name_ctlplane: {get_param: CloudNameCtlplane}
314
-      hosts:
315
-{% for role in roles %}
316
-        - list_join:
317
-            - '\n'
318
-            - {get_attr: [{{role.name}}, hosts_entry]}
319
-{% endfor %}
320 332
       enabled_services:
321 333
         list_join:
322 334
           - ','
@@ -517,6 +529,10 @@ resources:
517 529
   # Post deployment steps for all roles
518 530
   AllNodesDeploySteps:
519 531
     type: OS::TripleO::PostDeploySteps
532
+{% for role in roles %}
533
+    depends_on:
534
+      - {{role.name}}AllNodesDeployment
535
+{% endfor %}
520 536
     properties:
521 537
       servers:
522 538
 {% for role in roles %}
@@ -599,7 +615,7 @@ outputs:
599 615
     value:
600 616
       list_join:
601 617
       - "\n"
602
-      - - {get_attr: [allNodesConfig, hosts_entries]}
618
+      - - {get_attr: [hostsConfig, hosts_entries]}
603 619
       -
604 620
         - str_replace:
605 621
             template: IP  HOST

+ 0
- 12
puppet/all-nodes-config.yaml View File

@@ -12,8 +12,6 @@ parameters:
12 12
     type: string
13 13
   cloud_name_ctlplane:
14 14
     type: string
15
-  hosts:
16
-    type: comma_delimited_list
17 15
   # FIXME(shardy) this can be comma_delimited_list when
18 16
   # https://bugs.launchpad.net/heat/+bug/1617019 is fixed
19 17
   enabled_services:
@@ -66,10 +64,6 @@ resources:
66 64
     properties:
67 65
       group: os-apply-config
68 66
       config:
69
-        hosts:
70
-          list_join:
71
-          - "\n"
72
-          - {get_param: hosts}
73 67
         hiera:
74 68
           datafiles:
75 69
             bootstrap_node:
@@ -205,9 +199,3 @@ outputs:
205 199
     description: The ID of the allNodesConfigImpl resource.
206 200
     value:
207 201
       {get_resource: allNodesConfigImpl}
208
-  hosts_entries:
209
-    description: |
210
-      The content that should be appended to your /etc/hosts if you want to get
211
-      hostname-based access to the deployed nodes (useful for testing without
212
-      setting up a DNS).
213
-    value: {get_attr: [allNodesConfigImpl, config, hosts]}

Loading…
Cancel
Save