Merge "Add FreeIPA server installation script"
[apex-tripleo-heat-templates.git] / extraconfig / tasks / major_upgrade_pacemaker_init.j2.yaml
1 heat_template_version: ocata
2 description: 'Upgrade for Pacemaker deployments'
3
4 parameters:
5
6   servers:
7     type: json
8   input_values:
9     type: json
10     description: input values for the software deployments
11
12   UpgradeInitCommand:
13     type: string
14     description: |
15       Command or script snippet to run on all overcloud nodes to
16       initialize the upgrade process. E.g. a repository switch.
17     default: ''
18   UpgradeLevelNovaCompute:
19     type: string
20     description: Nova Compute upgrade level
21     default: ''
22
23 resources:
24
25   # For the UpgradeInit also rename /etc/resolv.conf.save for +bug/1567004
26
27   UpgradeInitConfig:
28     type: OS::Heat::SoftwareConfig
29     properties:
30       group: script
31       config:
32         list_join:
33         - ''
34         - - "#!/bin/bash\n\n"
35           - "if [[ -f /etc/resolv.conf.save ]] ; then rm /etc/resolv.conf.save; fi\n\n"
36           - get_param: UpgradeInitCommand
37
38   # TODO(jistr): for Mitaka->Newton upgrades and further we can use
39   # map_merge with input_values instead of feeding params into scripts
40   # via str_replace on bash snippets
41
42   # FIXME(shardy) we have hard-coded per-role *ScriptConfig's here
43   # Would be better to have a common config for all roles
44   ComputeDeliverUpgradeScriptConfig:
45     type: OS::Heat::SoftwareConfig
46     properties:
47       group: script
48       config:
49         list_join:
50         - ''
51         - - str_replace:
52               template: |
53                 #!/bin/bash
54                 upgrade_level_nova_compute='UPGRADE_LEVEL_NOVA_COMPUTE'
55               params:
56                 UPGRADE_LEVEL_NOVA_COMPUTE: {get_param: UpgradeLevelNovaCompute}
57           - get_file: pacemaker_common_functions.sh
58           - get_file: major_upgrade_compute.sh
59
60   ObjectStorageDeliverUpgradeScriptConfig:
61     type: OS::Heat::SoftwareConfig
62     properties:
63       group: script
64       config:
65         list_join:
66         - ''
67         - - get_file: pacemaker_common_functions.sh
68           - get_file: major_upgrade_object_storage.sh
69
70   CephStorageDeliverUpgradeScriptConfig:
71     type: OS::Heat::SoftwareConfig
72     properties:
73       group: script
74       config:
75         list_join:
76         - ''
77         - - get_file: pacemaker_common_functions.sh
78           - get_file: major_upgrade_ceph_storage.sh
79
80 {% for role in roles %}
81   UpgradeInit{{role.name}}Deployment:
82     type: OS::Heat::SoftwareDeploymentGroup
83     properties:
84       servers:  {get_param: [servers, {{role.name}}]}
85       config: {get_resource: UpgradeInitConfig}
86       input_values: {get_param: input_values}
87
88   {% if not role.name in ['Controller', 'BlockStorage'] %}
89   {{role.name}}DeliverUpgradeScriptDeployment:
90     type: OS::Heat::SoftwareDeploymentGroup
91     properties:
92       servers:  {get_param: [servers, {{role.name}}]}
93       config: {get_resource: {{role.name}}DeliverUpgradeScriptConfig}
94       input_values: {get_param: input_values}
95   {% endif %}
96 {% endfor %}