Merge "Add trigger to setup a LDAP backend as keystone domaine"
[apex-tripleo-heat-templates.git] / puppet / major_upgrade_steps.j2.yaml
index 3362a01..c0a0778 100644 (file)
@@ -32,20 +32,6 @@ parameters:
     type: string
     hidden: true
 
-conditions:
-  # Conditions to disable any steps where the task list is empty
-{%- for role in roles %}
-  {{role.name}}UpgradeBatchConfigEnabled:
-    not:
-      equals:
-        - {get_param: [role_data, {{role.name}}, upgrade_batch_tasks]}
-        - []
-  {{role.name}}UpgradeConfigEnabled:
-    not:
-      equals:
-        - {get_param: [role_data, {{role.name}}, upgrade_tasks]}
-        - []
-{%- endfor %}
 
 resources:
 
@@ -65,20 +51,24 @@ resources:
           - "  crudini --set /etc/nova/nova.conf placement project_domain_name Default\n\n"
           - "  crudini --set /etc/nova/nova.conf placement user_domain_name Default\n\n"
           - "  crudini --set /etc/nova/nova.conf placement project_name service\n\n"
-          - "  systemctl restart openstack-nova-compute\n\n"
-          - "fi\n\n"
           - str_replace:
               template: |
                 crudini --set /etc/nova/nova.conf placement password 'SERVICE_PASSWORD'
                 crudini --set /etc/nova/nova.conf placement region_name 'REGION_NAME'
                 crudini --set /etc/nova/nova.conf placement auth_url 'AUTH_URL'
-                ROLE='ROLE_NAME'
               params:
                 SERVICE_PASSWORD: { get_param: NovaPassword }
                 REGION_NAME: { get_param: KeystoneRegion }
                 AUTH_URL: { get_param: [EndpointMap, KeystoneAdmin, uri_no_suffix]}
+          - "  systemctl restart openstack-nova-compute\n\n"
+          - "fi\n\n"
+          - str_replace:
+              template: |
+                ROLE='ROLE_NAME'
+              params:
                 ROLE_NAME: {{role.name}}
           - get_file: ../extraconfig/tasks/pacemaker_common_functions.sh
+          - get_file: ../extraconfig/tasks/run_puppet.sh
           - get_file: ../extraconfig/tasks/tripleo_upgrade_node.sh
 
   {{role.name}}DeliverUpgradeScriptDeployment:
@@ -99,12 +89,11 @@ resources:
   {{role.name}}UpgradeBatchConfig_Step{{step}}:
     type: OS::TripleO::UpgradeConfig
   {%- if step > 0 %}
-    condition: {{role.name}}UpgradeBatchConfigEnabled
-    {% if role.name in enabled_roles %}
+    {%- if role in enabled_roles %}
     depends_on:
       - {{role.name}}UpgradeBatch_Step{{step -1}}
     {%- endif %}
-  {% else %}
+  {%- else %}
     {% for role in roles if role.disable_upgrade_deployment|default(false) %}
       {% if deliver_script.update({'deliver': True}) %} {% endif %}
     {% endfor %}
@@ -124,13 +113,11 @@ resources:
   {%- for role in enabled_roles %}
   {{role.name}}UpgradeBatch_Step{{step}}:
     type: OS::Heat::SoftwareDeploymentGroup
-    condition: {{role.name}}UpgradeBatchConfigEnabled
     {%- if step > 0 %}
     depends_on:
-      - {{role.name}}UpgradeBatch_Step{{step -1}}
-    {% else %}
-    depends_on:
-      - {{role.name}}UpgradeBatchConfig_Step{{step}}
+      {%- for role_inside in enabled_roles %}
+      - {{role_inside.name}}UpgradeBatch_Step{{step -1}}
+      {%- endfor %}
     {%- endif %}
     update_policy:
       batch_create:
@@ -184,11 +171,10 @@ resources:
   # do, and there should be minimal performance hit (creating the
   # config is cheap compared to the time to apply the deployment).
   {%- if step > 0 %}
-    condition: {{role.name}}UpgradeConfigEnabled
-    {% if role.name in enabled_roles %}
+    {%- if role in enabled_roles %}
     depends_on:
       - {{role.name}}Upgrade_Step{{step -1}}
-    {% endif %}
+    {%- endif %}
   {%- endif %}
     properties:
       UpgradeStepConfig: {get_param: [role_data, {{role.name}}, upgrade_tasks]}
@@ -200,9 +186,18 @@ resources:
   {{role.name}}Upgrade_Step{{step}}:
     type: OS::Heat::SoftwareDeploymentGroup
     {%- if step > 0 %}
-    condition: {{role.name}}UpgradeConfigEnabled
+    # Make sure we wait that all roles have finished their own
+    # previous step before going to the next, so we can guarantee
+    # state for each steps.
     depends_on:
-      - {{role.name}}Upgrade_Step{{step -1}}
+      {%- for role_inside in enabled_roles %}
+      - {{role_inside.name}}Upgrade_Step{{step -1}}
+      {%- endfor %}
+    {%- else %}
+    depends_on:
+      {%- for role_inside in enabled_roles %}
+      - {{role_inside.name}}UpgradeBatch_Step{{batch_upgrade_steps_max -1}}
+      {%- endfor %}
     {%- endif %}
     properties:
       name: {{role.name}}Upgrade_Step{{step}}