Skip to content

Commit

Permalink
Harmonization of resource names for HANA HA (#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
jankohoutek authored Oct 23, 2024
1 parent cd19faf commit e01d8b3
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 71 deletions.
6 changes: 3 additions & 3 deletions ansible/playbooks/sap-hana-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
crypto_cipher: aes256
# Define some names in a central place
rsc_socat: "rsc_socat_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}"
rsc_SAPHana: "rsc_SAPHana_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}"
rsc_saphanactl: "rsc_SAPHanaCtl_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}"


handlers:
Expand Down Expand Up @@ -81,7 +81,7 @@
cmd: >-
crm resource
refresh
msl_SAPHana_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}
msl_SAPHanaCtl_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}
when: is_primary

- name: Wait for cluster to settle
Expand All @@ -94,6 +94,6 @@
cmd: >-
crm resource
maintenance
msl_SAPHana_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}
msl_SAPHanaCtl_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}
off
when: is_primary
34 changes: 17 additions & 17 deletions ansible/playbooks/tasks/aws-cluster-hana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
ansible.builtin.set_fact:
crm_maintainence_mode: "{{ (crm_conf_hana_show.stdout | regex_search('maintenance-mode=([a-z]*)', '\\1'))[0] | default('unknown') }}"
stonith_timeout: "{{ crm_conf_hana_show.stdout | regex_search('stonith-timeout') }}" # this should be variable!
hana_resource: "{{ crm_conf_hana_show.stdout | regex_search('primitive rsc_SAPHana_') }}"
hana_clone: "{{ crm_conf_hana_show.stdout | regex_search('ms msl_SAPHana_') }}"
hana_topology_resource: "{{ crm_conf_hana_show.stdout | regex_search('primitive rsc_SAPHanaTopology') }}"
hana_topology_clone: "{{ crm_conf_hana_show.stdout | regex_search('clone cln_SAPHanaTopology') }}"
hana_resource: "{{ crm_conf_hana_show.stdout | regex_search('primitive rsc_SAPHanaCtl_') }}"
hana_clone: "{{ crm_conf_hana_show.stdout | regex_search('ms msl_SAPHanaCtl_') }}"
hana_topology_resource: "{{ crm_conf_hana_show.stdout | regex_search('primitive rsc_SAPHanaTpg') }}"
hana_topology_clone: "{{ crm_conf_hana_show.stdout | regex_search('clone cln_SAPHanaTpg') }}"
ip_resource: "{{ crm_conf_hana_show.stdout | regex_search('primitive rsc_ip_') }}"
ip_nc: "{{ crm_conf_hana_show.stdout | regex_search('primitive rsc_socat_') }}"
ip_grp: "{{ crm_conf_hana_show.stdout | regex_search('group g_ip_') }}"
Expand All @@ -31,10 +31,10 @@
ansible.builtin.command:
cmd: >-
crm configure primitive
rsc_SAPHanaTopology_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}
rsc_SAPHanaTpg_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}
ocf:suse:SAPHanaTopology
operations
$id="rsc_sap2_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}-operations"
$id="rsc_sap2_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}-operations"
op monitor interval="10" timeout="600"
op start interval="0" timeout="600"
op stop interval="0" timeout="300"
Expand All @@ -48,8 +48,8 @@
ansible.builtin.command:
cmd: >-
crm configure clone
cln_SAPHanaTopology_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}
rsc_SAPHanaTopology_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}
cln_SAPHanaTpg_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}
rsc_SAPHanaTpg_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}
meta
clone-node-max="1"
target-role="Started"
Expand All @@ -62,10 +62,10 @@
ansible.builtin.command:
cmd: >-
crm configure primitive
rsc_SAPHana_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}
rsc_SAPHanaCtl_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}
ocf:suse:SAPHana
operations
$id="rsc_sap_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}-operations"
$id="rsc_sap_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}-operations"
op start interval="0" timeout="3600"
op stop interval="0" timeout="3600"
op promote interval="0" timeout="3600"
Expand All @@ -85,8 +85,8 @@
ansible.builtin.command:
cmd: >-
crm configure ms
msl_SAPHana_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}
rsc_SAPHana_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}
msl_SAPHanaCtl_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}
rsc_SAPHanaCtl_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}
meta
notify="true"
clone-max="2"
Expand All @@ -101,10 +101,10 @@
ansible.builtin.command:
cmd: >-
crm configure colocation
col_saphana_ip_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}
col_saphana_ip_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}
2000:
rsc_ip_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}:Started
msl_SAPHana_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}:Master
rsc_ip_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}:Started
msl_SAPHanaCtl_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}:Master
when: ip_colo | length == 0

- name: Configure order
Expand All @@ -113,8 +113,8 @@
crm configure order
ord_SAPHana
2000:
cln_SAPHanaTopology_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}
msl_SAPHana_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}
cln_SAPHanaTpg_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}
msl_SAPHanaCtl_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}
when: cluster_order | length == 0

# Get current maintainence state
Expand Down
46 changes: 23 additions & 23 deletions ansible/playbooks/tasks/azure-cluster-hana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
crm_maintenance_mode: "{{ (crm_conf_show.stdout | regex_search('maintenance-mode=([a-z]*)', '\\1'))[0] }}"
stonith_enabled: "{{ (crm_conf_show.stdout | regex_search('stonith-enabled=([a-z]*)', '\\1'))[0] | default('false') }}"
stonith_timeout: "{{ crm_conf_show.stdout | regex_search('stonith-timeout') }}" # this should be variable!
hana_resource: "{{ crm_conf_show.stdout | regex_search('primitive rsc_SAPHana_') }}"
hana_clone: "{{ crm_conf_show.stdout | regex_search('ms msl_SAPHana_') }}"
hana_topology_resource: "{{ crm_conf_show.stdout | regex_search('primitive rsc_SAPHanaTopology') }}"
hana_topology_clone: "{{ crm_conf_show.stdout | regex_search('clone cln_SAPHanaTopology') }}"
hana_resource: "{{ crm_conf_show.stdout | regex_search('primitive rsc_SAPHanaCtl_') }}"
hana_clone: "{{ crm_conf_show.stdout | regex_search('ms msl_SAPHanaCtl_') }}"
hana_topology_resource: "{{ crm_conf_show.stdout | regex_search('primitive rsc_SAPHanaTpg') }}"
hana_topology_clone: "{{ crm_conf_show.stdout | regex_search('clone cln_SAPHanaTpg') }}"
ip_resource: "{{ crm_conf_show.stdout | regex_search('primitive rsc_ip_') }}"
ip_nc: "{{ crm_conf_show.stdout | regex_search('primitive rsc_socat_') }}"
ip_grp: "{{ crm_conf_show.stdout | regex_search('group g_ip_') }}"
Expand All @@ -27,10 +27,10 @@
ansible.builtin.command:
cmd: >-
crm configure primitive
rsc_SAPHanaTopology_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}
rsc_SAPHanaTpg_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}
ocf:suse:SAPHanaTopology
operations
$id="rsc_sap2_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}-operations"
$id="rsc_sap2_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}-operations"
op monitor interval="10" timeout="600"
op start interval="0" timeout="600"
op stop interval="0" timeout="300"
Expand Down Expand Up @@ -62,8 +62,8 @@
ansible.builtin.command:
cmd: >-
crm configure clone
cln_SAPHanaTopology_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}
rsc_SAPHanaTopology_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}
cln_SAPHanaTpg_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}
rsc_SAPHanaTpg_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}
meta
clone-node-max="1"
target-role="Started"
Expand All @@ -74,10 +74,10 @@
ansible.builtin.command:
cmd: >-
crm configure primitive
{{ rsc_SAPHana }}
{{ rsc_saphanactl }}
ocf:suse:SAPHana
operations
$id="rsc_sap_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}-operations"
$id="rsc_sap_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}-operations"
op start interval="0" timeout="3600"
op stop interval="0" timeout="3600"
op promote interval="0" timeout="3600"
Expand All @@ -95,8 +95,8 @@
ansible.builtin.command:
cmd: >-
crm configure ms
msl_SAPHana_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}
{{ rsc_SAPHana }}
msl_SAPHanaCtl_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}
{{ rsc_saphanactl }}
meta
notify="true"
clone-max="2"
Expand All @@ -119,12 +119,12 @@
ansible.builtin.command:
cmd: >-
crm configure primitive
rsc_ip_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}
rsc_ip_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}
ocf:heartbeat:IPaddr2
meta
target-role="Started"
operations
$id="rsc_ip_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}-operations"
$id="rsc_ip_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}-operations"
op monitor interval="10s" timeout="20s"
params ip="{{ cluster_ip }}"
when: ip_resource | length == 0
Expand All @@ -146,29 +146,29 @@
ansible.builtin.command:
cmd: >-
crm configure group
g_ip_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}
rsc_ip_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}
g_ip_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}
rsc_ip_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}
{{ rsc_socat }}
when: ip_grp | length == 0

- name: Configure hana/IP colocation
ansible.builtin.command:
cmd: >-
crm configure colocation
col_saphana_ip_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}
col_saphana_ip_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}
4000:
g_ip_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}:Started
msl_SAPHana_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}:Master
g_ip_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}:Started
msl_SAPHanaCtl_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}:Master
when: ip_colo | length == 0

- name: Configure order
ansible.builtin.command:
cmd: >-
crm configure order
ord_SAPHana_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}
ord_SAPHana_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}
Optional:
cln_SAPHanaTopology_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}
msl_SAPHana_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}
cln_SAPHanaTpg_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}
msl_SAPHanaCtl_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}
when: cluster_order | length == 0

- name: Wait for cluster to settle
Expand All @@ -180,7 +180,7 @@
# Plus the linter doesn't like it!
- name: Cleanup
ansible.builtin.command:
cmd: crm resource cleanup {{ rsc_SAPHana }}
cmd: crm resource cleanup {{ rsc_saphanactl }}

- name: Wait for cluster to settle
ansible.builtin.command:
Expand Down
14 changes: 7 additions & 7 deletions ansible/playbooks/tasks/cluster-bootstrap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@
ansible.builtin.command:
cmd: >-
crm configure primitive
rsc_ip_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}
rsc_ip_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}
ocf:suse:aws-vpc-move-ip params
ip={{ aws_cluster_ip }}
routing_table={{ aws_route_table_id }}
Expand All @@ -441,7 +441,7 @@
ansible.builtin.command:
cmd: >-
crm configure primitive
rsc_ip_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}
rsc_ip_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}
IPaddr2
params ip={{ gcp_cluster_ip }}
cidr_netmask=32
Expand All @@ -457,7 +457,7 @@
ansible.builtin.command:
cmd: >-
crm resource locate
rsc_ip_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}
rsc_ip_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}
register: reg_vip_location
changed_when: false
when: is_primary
Expand All @@ -469,7 +469,7 @@
ansible.builtin.command:
cmd: >-
crm resource move
rsc_ip_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}
rsc_ip_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}
{{ primary_hostname }}
register: reg_move_cmd
when:
Expand All @@ -483,7 +483,7 @@
ansible.builtin.command:
cmd: >-
crm resource locate
rsc_ip_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}
rsc_ip_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}
register: reg_vip_location2
when:
- is_primary
Expand All @@ -496,7 +496,7 @@
ansible.builtin.command:
cmd: >-
crm resource clear
rsc_ip_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}
rsc_ip_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}
when:
- is_primary
- reg_vip_location.stdout | trim | split(' ') | last != primary_hostname
Expand All @@ -521,7 +521,7 @@
cmd: >-
crm configure group
grp_ip_hc
rsc_ip_HDB_{{ sap_hana_install_sid }}{{ sap_hana_install_instance_number }}
rsc_ip_{{ sap_hana_install_sid }}_HDB{{ sap_hana_install_instance_number }}
rsc_healthcheck_primary
when:
- is_primary
Expand Down
Loading

0 comments on commit e01d8b3

Please sign in to comment.