Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sap_ha_pacemaker_cluster: Allow to append manual cluster config to the generated config #922

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion roles/sap_ha_pacemaker_cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ It is recommended to execute this role together with other roles in this collect

#### SAP Netweaver cluster
1. [sap_general_preconfigure](https://github.com/sap-linuxlab/community.sap_install/tree/main/roles/sap_general_preconfigure)
2. [sap_netweaver_preconfigure](https://github.com/sap-linuxlab/community.sap_install/tree/main/roles/sap_netweaver_preconfigure)
2. [sap_netweaver_preconfigure](https://github.com/sap-linuxlab/community.sap_install/tree/main/roles/sap_netweaver_preconfigure)
3. [sap_install_media_detect](https://github.com/sap-linuxlab/community.sap_install/tree/main/roles/sap_install_media_detect)
4. [sap_swpm](https://github.com/sap-linuxlab/community.sap_install/tree/main/roles/sap_swpm)
5. *`sap_ha_pacemaker_cluster`*
Expand Down Expand Up @@ -146,6 +146,22 @@ It is recommended to execute this role together with other roles in this collect

<!-- BEGIN Further Information -->
## Further Information

### sap_ha_pacemaker_cluster_*_append variables
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section should be done same as I did it here:

<details>
  <summary>Appending custom cluster resources</summary>
  ...
</details>

`*EXPERIMENTAL*`<br>
This role inherits pre-defined `ha_cluster*` variables and merges them with role specific parameters. <br>
However, in some cases the order of resources is important. The `*_append` variables allow to append a specific cluster configuration AFTER the configuration generated by this role. <br>

The order in which cluster configuration is generated before it's passed to `ha_cluster` role is:
1. `ha_cluster*` variables (if defined).
2. Configuration created by this role based on provided parameters.
3. The content of `sap_ha_pacemaker_*_append` variables is appended.
<br>

NOTE: There is no check to validate the content of the `*_append` variables. You must append your configuration in a way that it doesn't break the configuration generated by this role.<br>
NOTE: The config in the `*_append` variables is appended only if this role has created entries in the equivalent HA cluster variable e.g. `ha_cluster_constraints_colocation` during the run. If nothing has been defined by this role, there is no reason to append anything. In this case just use the appropriate `ha_cluster*` variable (step 1. above).
<br>

For more examples on how to use this role in different installation scenarios, refer to the [ansible.playbooks_for_sap](https://github.com/sap-linuxlab/ansible.playbooks_for_sap) playbooks.

Cluster can be further customized with inputs available from underlying role [ha_cluster](https://github.com/linux-system-roles/ha_cluster/blob/main/README.md), which will take precedence over `sap_ha_pacemaker_cluster` inputs.
Expand Down
74 changes: 74 additions & 0 deletions roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,80 @@ argument_specs:
no_log: true
required: true

##########################################################################
# Parameters that are optionally appended to 'sap_ha_pacemaker' parameters
##########################################################################

sap_ha_pacemaker_cluster_constraints_colocation_append:
type: dict
description:
- EXPERIMENTAL
- Additional colocation constraints to be appended to the generated constraints.
- Equivalent to `ha_cluster_constraints_colocation` in the `ha_cluster` Linux System Role.
- Supported options can be reviewed in the `ha_cluster` Linux System Role
[https://github.com/linux-system-roles/ha_cluster/blob/master/README.md].

example:
sap_ha_pacemaker_cluster_constraints_location_append:
- resource:
id: "grp_{{ sap_system_sid }}_ASCS{{ sap_ha_pacemaker_cluster_nwas_abap_ascs_instance_nr }}"
rule: "ethmonitor-ens192 ne 1"
id: "location-grp_{{ sap_system_sid }}_ASCS{{ sap_ha_pacemaker_cluster_nwas_abap_ascs_instance_nr }}"
options:
- name: score
value: -INFINITY

sap_ha_pacemaker_cluster_constraints_location_append:
type: dict
description:
- EXPERIMENTAL
- Additional location constraints to be appended to the generated constraints.
- Equivalent to `ha_cluster_constraints_location` in the `ha_cluster` Linux System Role.
- Supported options can be reviewed in the `ha_cluster` Linux System Role
[https://github.com/linux-system-roles/ha_cluster/blob/master/README.md].


sap_ha_pacemaker_cluster_constraints_order_append:
type: dict
description:
- EXPERIMENTAL
- Additional order constraints to be appended to the generated constraints.
- Equivalent to `ha_cluster_constraints_order` in the `ha_cluster` Linux System Role.
- Supported options can be reviewed in the `ha_cluster` Linux System Role
[https://github.com/linux-system-roles/ha_cluster/blob/master/README.md].

sap_ha_pacemaker_cluster_resource_clones_append:
type: dict
description:
- EXPERIMENTAL
- Additional resource clones to be appended to the generated resource clones.
- Equivalent to `ha_cluster_resource_clones` in the `ha_cluster` Linux System Role.
- Supported options can be reviewed in the `ha_cluster` Linux System Role
[https://github.com/linux-system-roles/ha_cluster/blob/master/README.md].

example:
sap_ha_cluster_resource_clones_append:
- resource_id: ethmonitor-ens192

sap_ha_pacemaker_cluster_resource_primitives_append:
type: dict
description:
- EXPERIMENTAL
- Additional resource primitives to be appended to the generated resource primitives.
- Equivalent to `ha_cluster_resource_primitives` in the `ha_cluster` Linux System Role.
- Supported options can be reviewed in the `ha_cluster` Linux System Role
[https://github.com/linux-system-roles/ha_cluster/blob/master/README.md].

example:
sap_ha_cluster_resource_primitives_append:
- id: ethmonitor-ens192
agent: ocf:heartbeat:ethmonitor
instance_attrs:
- attrs:
- name: interface
value: ens192
- name: link_status_only
value: 'true'

##########################################################################
# HANA specific parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,17 @@
- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_constraints_colocation'"
when: __sap_ha_pacemaker_cluster_constraints_colocation is defined
ansible.builtin.set_fact:
ha_cluster_constraints_colocation: "{{ __sap_ha_pacemaker_cluster_constraints_colocation }}"
ha_cluster_constraints_colocation: "{{ __sap_ha_pacemaker_cluster_constraints_colocation + sap_ha_pacemaker_cluster_constraints_colocation_append | d([]) }}"

- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_constraints_location'"
when: __sap_ha_pacemaker_cluster_constraints_location is defined
ansible.builtin.set_fact:
ha_cluster_constraints_location: "{{ __sap_ha_pacemaker_cluster_constraints_location }}"
ha_cluster_constraints_location: "{{ __sap_ha_pacemaker_cluster_constraints_location + sap_ha_pacemaker_cluster_constraints_location_append | d([]) }}"

- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_constraints_order'"
when: __sap_ha_pacemaker_cluster_constraints_order is defined
ansible.builtin.set_fact:
ha_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order }}"
ha_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order + sap_ha_pacemaker_cluster_constraints_order_append | d([]) }}"

- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_extra_packages'"
when: __sap_ha_pacemaker_cluster_extra_packages is defined
Expand All @@ -105,7 +105,7 @@
- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_resource_clones'"
when: __sap_ha_pacemaker_cluster_resource_clones is defined
ansible.builtin.set_fact:
ha_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones }}"
ha_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones + sap_ha_pacemaker_cluster_resource_clones_append | d([]) }}"

- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_resource_groups'"
when: __sap_ha_pacemaker_cluster_resource_groups is defined
Expand All @@ -115,7 +115,7 @@
- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_resource_primitives'"
when: __sap_ha_pacemaker_cluster_resource_primitives is defined
ansible.builtin.set_fact:
ha_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives }}"
ha_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + sap_ha_pacemaker_cluster_resource_primitives_append | d([]) }}"
no_log: true # be paranoid, there could be credentials in it

- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_totem'"
Expand Down
Loading