|
1 | 1 | # SPDX-License-Identifier: Apache-2.0 |
2 | 2 | --- |
3 | | -# Variables containing variables must be constructed with values |
4 | | -# to be fed into an included role |
| 3 | +- name: "SAP HA Prepare Pacemaker - Add resource: SAP HANA Topology" |
| 4 | + ansible.builtin.set_fact: |
| 5 | + __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_hana_topology] }}" |
| 6 | + vars: |
| 7 | + __resource_hana_topology: |
| 8 | + id: "{{ __sap_ha_pacemaker_cluster_hana_topology_resource_name }}" |
| 9 | + agent: "{{ __sap_ha_pacemaker_cluster_resource_agents.saphanatopology }}" |
| 10 | + instance_attrs: |
| 11 | + - attrs: |
| 12 | + - name: SID |
| 13 | + value: "{{ __sap_ha_pacemaker_cluster_hana_sid }}" |
| 14 | + - name: InstanceNumber |
| 15 | + value: "{{ __sap_ha_pacemaker_cluster_hana_instance_nr }}" |
| 16 | + operations: |
| 17 | + - action: start |
| 18 | + attrs: |
| 19 | + - name: timeout |
| 20 | + value: 600 |
| 21 | + - action: stop |
| 22 | + attrs: |
| 23 | + - name: timeout |
| 24 | + value: 300 |
| 25 | + - action: monitor |
| 26 | + attrs: |
| 27 | + - name: interval |
| 28 | + value: 30 |
| 29 | + - name: timeout |
| 30 | + value: 300 |
| 31 | + when: |
| 32 | + - __resource_hana_topology.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) |
5 | 33 |
|
6 | | -# TODO: add here any scale-out special variable constructions |
7 | | -# Make sure to first respect 'ha_cluster' native variables |
8 | 34 |
|
9 | | -# - name: "SAP HA Prepare Pacemaker - Construct cluster vars for SAP HANA Scale-out" |
10 | | -# ansible.builtin.set_fact: |
| 35 | +- name: "SAP HA Prepare Pacemaker - Add resource: SAP HANA DB" |
| 36 | + ansible.builtin.set_fact: |
| 37 | + __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_hana] }}" |
| 38 | + vars: |
| 39 | + __resource_hana: |
| 40 | + id: "{{ __sap_ha_pacemaker_cluster_hanacontroller_resource_name }}" |
| 41 | + agent: "{{ __sap_ha_pacemaker_cluster_resource_agents.saphanacontroller }}" |
| 42 | + instance_attrs: |
| 43 | + - attrs: |
| 44 | + - name: SID |
| 45 | + value: "{{ __sap_ha_pacemaker_cluster_hana_sid }}" |
| 46 | + - name: InstanceNumber |
| 47 | + value: "{{ __sap_ha_pacemaker_cluster_hana_instance_nr }}" |
| 48 | + - name: AUTOMATED_REGISTER |
| 49 | + value: "{{ sap_ha_pacemaker_cluster_hana_automated_register | string }}" |
| 50 | + - name: DUPLICATE_PRIMARY_TIMEOUT |
| 51 | + value: "{{ sap_ha_pacemaker_cluster_hana_duplicate_primary_timeout | string }}" |
| 52 | + - name: PREFER_SITE_TAKEOVER |
| 53 | + value: "{{ sap_ha_pacemaker_cluster_hana_prefer_site_takeover | string }}" |
| 54 | + operations: |
| 55 | + - action: start |
| 56 | + attrs: |
| 57 | + - name: timeout |
| 58 | + value: 3600 |
| 59 | + - action: stop |
| 60 | + attrs: |
| 61 | + - name: timeout |
| 62 | + value: 3600 |
| 63 | + - action: monitor |
| 64 | + attrs: |
| 65 | + - name: interval |
| 66 | + value: 61 |
| 67 | + - name: role |
| 68 | + value: Unpromoted |
| 69 | + - name: timeout |
| 70 | + value: 700 |
| 71 | + - action: monitor |
| 72 | + attrs: |
| 73 | + - name: interval |
| 74 | + value: 60 |
| 75 | + - name: role |
| 76 | + value: Promoted |
| 77 | + - name: timeout |
| 78 | + value: 700 |
| 79 | + - action: promote |
| 80 | + attrs: |
| 81 | + - name: timeout |
| 82 | + value: 700 |
| 83 | + - action: demote |
| 84 | + attrs: |
| 85 | + - name: timeout |
| 86 | + value: 320 |
| 87 | + meta_attrs: |
| 88 | + - attrs: |
| 89 | + - name: priority |
| 90 | + value: 100 |
| 91 | + when: |
| 92 | + - __resource_hana.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) |
11 | 93 |
|
12 | | -- name: "SAP HA Prepare Pacemaker - Info" |
13 | | - ansible.builtin.debug: |
14 | | - msg: "INFO: There is currently no Scale-out specific construction, in addition to the SAP HANA common definitions." |
| 94 | +# The filesystem resource is only created when 'angi' detection is enabled |
| 95 | +# and the 'angi' package is available. |
| 96 | +- name: "SAP HA Prepare Pacemaker - Add resource: SAP HANA Filesystem" |
| 97 | + ansible.builtin.set_fact: |
| 98 | + __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_hana_filesystem] }}" |
| 99 | + vars: |
| 100 | + __resource_hana_filesystem: |
| 101 | + id: "{{ __sap_ha_pacemaker_cluster_hana_filesystem_resource_name }}" |
| 102 | + agent: "{{ __sap_ha_pacemaker_cluster_resource_agents.saphanafilesystem }}" |
| 103 | + instance_attrs: |
| 104 | + - attrs: |
| 105 | + - name: SID |
| 106 | + value: "{{ __sap_ha_pacemaker_cluster_hana_sid }}" |
| 107 | + - name: InstanceNumber |
| 108 | + value: "{{ __sap_ha_pacemaker_cluster_hana_instance_nr }}" |
| 109 | + - name: ON_FAIL_ACTION |
| 110 | + value: fence |
| 111 | + operations: |
| 112 | + - action: start |
| 113 | + attrs: |
| 114 | + - name: interval |
| 115 | + value: 0 |
| 116 | + - name: timeout |
| 117 | + value: 10 |
| 118 | + - action: stop |
| 119 | + attrs: |
| 120 | + - name: interval |
| 121 | + value: 0 |
| 122 | + - name: timeout |
| 123 | + value: 20 |
| 124 | + - action: monitor |
| 125 | + attrs: |
| 126 | + - name: interval |
| 127 | + value: 120 |
| 128 | + - name: timeout |
| 129 | + value: 180 |
| 130 | + when: |
| 131 | + - __resource_hana_filesystem.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) |
| 132 | + - sap_ha_pacemaker_cluster_hana_create_filesystem_resource |
| 133 | + - sap_ha_pacemaker_cluster_saphanasr_angi_detection |
| 134 | + - __sap_ha_pacemaker_cluster_saphanasr_angi_available |
| 135 | + |
| 136 | + |
| 137 | +- name: "SAP HA Prepare Pacemaker - Add resource clone: SAP HANA Topology" |
| 138 | + ansible.builtin.set_fact: |
| 139 | + __sap_ha_pacemaker_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones + [__clone_hana_topology] }}" |
| 140 | + vars: |
| 141 | + __clone_hana_topology: |
| 142 | + id: "{{ __sap_ha_pacemaker_cluster_hana_topology_resource_clone_name }}" |
| 143 | + resource_id: "{{ __sap_ha_pacemaker_cluster_hana_topology_resource_name }}" |
| 144 | + meta_attrs: |
| 145 | + - attrs: |
| 146 | + - name: clone-max |
| 147 | + value: "{{ __sap_ha_pacemaker_cluster_meta_clone_max }}" |
| 148 | + - name: clone-node-max |
| 149 | + value: 1 |
| 150 | + - name: interleave |
| 151 | + value: "true" |
| 152 | + when: |
| 153 | + - __clone_hana_topology.resource_id not in (__sap_ha_pacemaker_cluster_resource_clones | map(attribute='resource_id')) |
| 154 | + |
| 155 | + |
| 156 | +- name: "SAP HA Prepare Pacemaker - Add resource clone: SAP HANA Controller" |
| 157 | + ansible.builtin.set_fact: |
| 158 | + __sap_ha_pacemaker_cluster_resource_clones: |
| 159 | + "{{ __sap_ha_pacemaker_cluster_resource_clones + [__clone_hana] }}" |
| 160 | + vars: |
| 161 | + __clone_hana: |
| 162 | + id: "{{ __sap_ha_pacemaker_cluster_hanacontroller_resource_clone_name }}" |
| 163 | + resource_id: "{{ __sap_ha_pacemaker_cluster_hanacontroller_resource_name }}" |
| 164 | + meta_attrs: |
| 165 | + - attrs: |
| 166 | + - name: clone-max |
| 167 | + value: "{{ __sap_ha_pacemaker_cluster_meta_clone_max }}" |
| 168 | + - name: clone-node-max |
| 169 | + value: 1 |
| 170 | + - name: interleave |
| 171 | + value: "true" |
| 172 | + - name: promotable |
| 173 | + value: "true" |
| 174 | + - name: maintenance |
| 175 | + value: "true" |
| 176 | + when: |
| 177 | + - __clone_hana.resource_id not in (__sap_ha_pacemaker_cluster_resource_clones | map(attribute='resource_id')) |
| 178 | + |
| 179 | +- name: "SAP HA Prepare Pacemaker - Add resource clone: SAP HANA Filesystem" |
| 180 | + ansible.builtin.set_fact: |
| 181 | + __sap_ha_pacemaker_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones + [__clone_hana_filesystem] }}" |
| 182 | + vars: |
| 183 | + __clone_hana_filesystem: |
| 184 | + id: "{{ __sap_ha_pacemaker_cluster_hana_filesystem_resource_clone_name }}" |
| 185 | + resource_id: "{{ __sap_ha_pacemaker_cluster_hana_filesystem_resource_name }}" |
| 186 | + meta_attrs: |
| 187 | + - attrs: |
| 188 | + - name: clone-max |
| 189 | + value: "{{ __sap_ha_pacemaker_cluster_meta_clone_max }}" |
| 190 | + - name: clone-node-max |
| 191 | + value: 1 |
| 192 | + - name: interleave |
| 193 | + value: "true" |
| 194 | + when: |
| 195 | + - __clone_hana_filesystem.resource_id not in (__sap_ha_pacemaker_cluster_resource_clones | map(attribute='resource_id')) |
| 196 | + - sap_ha_pacemaker_cluster_hana_create_filesystem_resource |
| 197 | + - sap_ha_pacemaker_cluster_saphanasr_angi_detection |
| 198 | + - __sap_ha_pacemaker_cluster_saphanasr_angi_available |
| 199 | + |
| 200 | +# First start Topology, then HANA (automatically stops in reverse order) |
| 201 | +- name: "SAP HA Prepare Pacemaker - Add order constraint: Topology starts before DB" |
| 202 | + ansible.builtin.set_fact: |
| 203 | + __sap_ha_pacemaker_cluster_constraints_order: |
| 204 | + "{{ __sap_ha_pacemaker_cluster_constraints_order + [__constraint_order_hana_topology] }}" |
| 205 | + vars: |
| 206 | + __constraint_order_hana_topology: |
| 207 | + id: "{{ __sap_ha_pacemaker_cluster_hana_order_topology_hana_name }}" |
| 208 | + resource_first: |
| 209 | + id: "{{ __sap_ha_pacemaker_cluster_hana_topology_resource_clone_name }}" |
| 210 | + action: start |
| 211 | + resource_then: |
| 212 | + id: "{{ __sap_ha_pacemaker_cluster_hanacontroller_resource_clone_name }}" |
| 213 | + action: start |
| 214 | + options: |
| 215 | + - name: symmetrical |
| 216 | + value: "false" |
| 217 | + when: |
| 218 | + - __constraint_order_hana_topology.resource_then not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_then')) |
0 commit comments