Merge "Add Octavia API service definitions"
[apex-tripleo-heat-templates.git] / puppet / major_upgrade_steps.j2.yaml
1 heat_template_version: ocata
2 description: 'Upgrade steps for all roles'
3
4 parameters:
5   servers:
6     type: json
7
8   role_data:
9     type: json
10     description: Mapping of Role name e.g Controller to the per-role data
11
12   UpdateIdentifier:
13     type: string
14     description: >
15       Setting to a previously unused value during stack-update will trigger
16       the Upgrade resources to re-run on all roles.
17
18 resources:
19
20 # Upgrade Steps for all roles
21 # FIXME(shardy): would be nice to make the number of steps configurable
22 {% for step in range(0, 8) %}
23   {% for role in roles %}
24   # Step {{step}} resources
25   {{role.name}}UpgradeConfig_Step{{step}}:
26     type: OS::TripleO::UpgradeConfig
27   # The UpgradeConfig resources could actually be created without
28   # serialization, but the event output is easier to follow if we
29   # do, and there should be minimal performance hit (creating the
30   # config is cheap compared to the time to apply the deployment).
31   {% if step > 0 %}
32     depends_on:
33       {% for dep in roles %}
34         {% if not dep.disable_upgrade_deployment|default(false) %}
35       - {{dep.name}}Upgrade_Step{{step -1}}
36         {% endif %}
37       {% endfor %}
38   {% endif %}
39     properties:
40       UpgradeStepConfig: {get_param: [role_data, {{role.name}}, upgrade_tasks]}
41       step: {{step}}
42   {% if not role.disable_upgrade_deployment|default(false) %}
43   {{role.name}}Upgrade_Step{{step}}:
44     type: OS::Heat::StructuredDeploymentGroup
45   {% if step > 0 %}
46     depends_on:
47       {% for dep in roles %}
48         {% if not dep.disable_upgrade_deployment|default(false) %}
49       - {{dep.name}}Upgrade_Step{{step -1}}
50         {% endif %}
51       {% endfor %}
52   {% endif %}
53     properties:
54       name: {{role.name}}Upgrade_Step{{step}}
55       servers: {get_param: [servers, {{role.name}}]}
56       config: {get_resource: {{role.name}}UpgradeConfig_Step{{step}}}
57       input_values:
58         role: {{role.name}}
59         update_identifier: {get_param: UpdateIdentifier}
60   {% endif %}
61   {% endfor %}
62 {% endfor %}
63
64 outputs:
65   # Output the config for each role, just use Step1 as the config should be
66   # the same for all steps (only the tag provided differs)
67   upgrade_configs:
68     description: The per-role upgrade configuration used
69     value:
70 {% for role in roles %}
71       {{role.name.lower()}}: {get_attr: [{{role.name}}UpgradeConfig_Step1, upgrade_config]}
72 {% endfor %}
73