Browse Source

Put user data in the main stack

We create user data per instance, but two are global for all, and the
last one per role, so we can move it up the stack.

Change-Id: I1330e54744adef9be159edd8f01aefa3db85a480
tags/10.3.0
Thomas Herve 6 months ago
parent
commit
862f52cce0
2 changed files with 32 additions and 28 deletions
  1. 28
    0
      overcloud.j2.yaml
  2. 4
    28
      puppet/role.role.j2.yaml

+ 28
- 0
overcloud.j2.yaml View File

@@ -396,6 +396,16 @@ resources:
396 396
             - {get_attr: [{{role.name}}, known_hosts_hostnames]}
397 397
             {% endfor %}
398 398
 
399
+  # Creates the "heat-admin" user if configured via the environment
400
+  # Should return a OS::Heat::MultipartMime reference via OS::stack_id
401
+  NodeAdminUserData:
402
+    type: OS::TripleO::NodeAdminUserData
403
+
404
+  # For optional operator additional userdata
405
+  # Should return a OS::Heat::MultipartMime reference via OS::stack_id
406
+  NodeUserData:
407
+    type: OS::TripleO::NodeUserData
408
+
399 409
   # Jinja loop for Role in roles_data.yaml
400 410
 {% for role in roles %}
401 411
   # Resources generated for {{role.name}} Role
@@ -552,6 +562,23 @@ resources:
552 562
           data:
553 563
             - {get_attr: [{{role.name}}, hostname_map]}
554 564
 
565
+  # Combine the NodeAdminUserData and NodeUserData mime archives
566
+  {{role.name}}UserData:
567
+    type: OS::Heat::MultipartMime
568
+    properties:
569
+      parts:
570
+      - config: {get_resource: NodeAdminUserData}
571
+        type: multipart
572
+      - config: {get_resource: NodeUserData}
573
+        type: multipart
574
+      - config: {get_resource: {{role.name}}RoleUserData}
575
+        type: multipart
576
+
577
+  # For optional operator role-specific userdata
578
+  # Should return a OS::Heat::MultipartMime reference via OS::stack_id
579
+  {{role.name}}RoleUserData:
580
+    type: OS::TripleO::{{role.name}}::NodeUserData
581
+
555 582
   {{role.name}}:
556 583
     type: OS::Heat::ResourceGroup
557 584
     depends_on: Networks
@@ -590,6 +617,7 @@ resources:
590 617
             map_merge:
591 618
               - {{role.RoleParametersDefault|default({})}}
592 619
               - get_param: {{role.name}}Parameters
620
+          UserData: {get_resource: {{role.name}}UserData}
593 621
 {% endfor %}
594 622
 
595 623
 {% for role in roles %}

+ 4
- 28
puppet/role.role.j2.yaml View File

@@ -289,6 +289,9 @@ parameters:
289 289
     constraints:
290 290
       - allowed_values: [delete, retain]
291 291
 
292
+  UserData:
293
+    type: string
294
+
292 295
 {% if role.uses_deprecated_params|default(false) %}
293 296
 parameter_groups:
294 297
 - label: deprecated
@@ -424,7 +427,7 @@ resources:
424 427
           - network: ctlplane
425 428
             subnet: {get_param: {{role.name}}ControlPlaneSubnet}
426 429
       user_data_format: SOFTWARE_CONFIG
427
-      user_data: {get_resource: UserData}
430
+      user_data: {get_param: UserData}
428 431
       name:
429 432
         yaql:
430 433
           expression: $.data.hostname_map.get($.data.hostname, $.data.hostname).toLower()
@@ -448,33 +451,6 @@ resources:
448 451
           - {get_param: [DeploymentSwiftDataMap,
449 452
                          {get_param: Hostname}]}
450 453
 
451
-  # Combine the NodeAdminUserData and NodeUserData mime archives
452
-  UserData:
453
-    type: OS::Heat::MultipartMime
454
-    properties:
455
-      parts:
456
-      - config: {get_resource: NodeAdminUserData}
457
-        type: multipart
458
-      - config: {get_resource: NodeUserData}
459
-        type: multipart
460
-      - config: {get_resource: RoleUserData}
461
-        type: multipart
462
-
463
-  # Creates the "heat-admin" user if configured via the environment
464
-  # Should return a OS::Heat::MultipartMime reference via OS::stack_id
465
-  NodeAdminUserData:
466
-    type: OS::TripleO::NodeAdminUserData
467
-
468
-  # For optional operator additional userdata
469
-  # Should return a OS::Heat::MultipartMime reference via OS::stack_id
470
-  NodeUserData:
471
-    type: OS::TripleO::NodeUserData
472
-
473
-  # For optional operator role-specific userdata
474
-  # Should return a OS::Heat::MultipartMime reference via OS::stack_id
475
-  RoleUserData:
476
-    type: OS::TripleO::{{role.name}}::NodeUserData
477
-
478 454
   {%- for network in networks %}
479 455
   {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
480 456
   {{network.name}}Port:

Loading…
Cancel
Save