-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #471 from ja9fuchs/ha_for_nw
sap_ha_pacemaker_cluster: enhanced pre-checks and improved variable handling
- Loading branch information
Showing
26 changed files
with
1,448 additions
and
721 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
818 changes: 518 additions & 300 deletions
818
roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml
Large diffs are not rendered by default.
Oops, something went wrong.
54 changes: 0 additions & 54 deletions
54
roles/sap_ha_pacemaker_cluster/tasks/ascertain_ha_cluster_in_inventory.yml
This file was deleted.
Oops, something went wrong.
95 changes: 95 additions & 0 deletions
95
roles/sap_ha_pacemaker_cluster/tasks/construct_final_hacluster_vars.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
--- | ||
# After all of the previous construction flows, the final parameters must | ||
# be translated to 'ha_cluster' Linux System Role syntax. | ||
# | ||
# This way the include_role parameters are set as play vars and do not | ||
# require a static list of vars when the role is included. | ||
|
||
# List of parameters that are constructed by this role, but not all of them | ||
# are mandatory to be defined. For any undefined parameter the default of the | ||
# 'ha_cluster' role will apply, if the role has a default defined. | ||
# | ||
# Make sure to always define those parameters which have no 'ha_cluster' LSR default! | ||
# | ||
# SAP HA Pacemaker Cluster role -> 'ha_cluster' Linux System Role | ||
# ------------------------------------------------------------------------------ | ||
# __sap_ha_pacemaker_cluster_ha_cluster ha_cluster | ||
# __sap_ha_pacemaker_cluster_cluster_name ha_cluster_cluster_name | ||
# __sap_ha_pacemaker_cluster_cluster_properties ha_cluster_cluster_properties | ||
# __sap_ha_pacemaker_cluster_constraints_colocation ha_cluster_constraints_colocation | ||
# __sap_ha_pacemaker_cluster_constraints_location ha_cluster_constraints_location | ||
# __sap_ha_pacemaker_cluster_constraints_order ha_cluster_constraints_order | ||
# __sap_ha_pacemaker_cluster_extra_packages ha_cluster_extra_packages | ||
# __sap_ha_pacemaker_cluster_fence_agent_packages ha_cluster_fence_agent_packages | ||
# __sap_ha_pacemaker_cluster_hacluster_password ha_cluster_hacluster_password | ||
# __sap_ha_pacemaker_cluster_repos __ha_cluster_repos | ||
# __sap_ha_pacemaker_cluster_resource_clones ha_cluster_resource_clones | ||
# __sap_ha_pacemaker_cluster_resource_groups ha_cluster_resource_groups | ||
# __sap_ha_pacemaker_cluster_resource_primitives ha_cluster_resource_primitives | ||
|
||
- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster'" | ||
when: __sap_ha_pacemaker_cluster_ha_cluster is defined | ||
ansible.builtin.set_fact: | ||
ha_cluster: "{{ __sap_ha_pacemaker_cluster_ha_cluster }}" | ||
|
||
- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_cluster_name'" | ||
when: __sap_ha_pacemaker_cluster_cluster_name is defined | ||
ansible.builtin.set_fact: | ||
ha_cluster_cluster_name: "{{ __sap_ha_pacemaker_cluster_cluster_name }}" | ||
|
||
- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_cluster_properties'" | ||
when: __sap_ha_pacemaker_cluster_cluster_properties is defined | ||
ansible.builtin.set_fact: | ||
ha_cluster_cluster_properties: "{{ __sap_ha_pacemaker_cluster_cluster_properties }}" | ||
|
||
- 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 }}" | ||
|
||
- 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 }}" | ||
|
||
- 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 }}" | ||
|
||
- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_extra_packages'" | ||
when: __sap_ha_pacemaker_cluster_extra_packages is defined | ||
ansible.builtin.set_fact: | ||
ha_cluster_extra_packages: "{{ __sap_ha_pacemaker_cluster_extra_packages }}" | ||
|
||
- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_fence_agent_packages'" | ||
when: __sap_ha_pacemaker_cluster_fence_agent_packages is defined | ||
ansible.builtin.set_fact: | ||
ha_cluster_fence_agent_packages: "{{ __sap_ha_pacemaker_cluster_fence_agent_packages }}" | ||
|
||
- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_hacluster_password'" | ||
when: __sap_ha_pacemaker_cluster_hacluster_password is defined | ||
ansible.builtin.set_fact: | ||
ha_cluster_hacluster_password: "{{ __sap_ha_pacemaker_cluster_hacluster_password }}" | ||
no_log: true # secure the credential | ||
|
||
- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_repos'" | ||
when: __sap_ha_pacemaker_cluster_repos is defined | ||
ansible.builtin.set_fact: | ||
__ha_cluster_repos: "{{ __sap_ha_pacemaker_cluster_repos }}" | ||
|
||
- 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 }}" | ||
|
||
- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_resource_groups'" | ||
when: __sap_ha_pacemaker_cluster_resource_groups is defined | ||
ansible.builtin.set_fact: | ||
ha_cluster_resource_groups: "{{ __sap_ha_pacemaker_cluster_resource_groups }}" | ||
|
||
- 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 }}" | ||
no_log: true # be paranoid, there could be credentials in it |
50 changes: 35 additions & 15 deletions
50
roles/sap_ha_pacemaker_cluster/tasks/construct_vars_common.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,49 @@ | ||
--- | ||
# Create or combine input parameters for the ha_cluster role. | ||
# Combine input parameters with inherited vars from the 'ha_cluster' role. | ||
# The inherited values take precedence. Some parameters are not required to be set. | ||
# The 'ha_cluster' LSR will apply its role defaults. | ||
# For mandatory parameters, sanity checks will be done separately. | ||
|
||
# sap_ha_pacemaker_cluster_cluster_name -> user-defined or default inherited from {{ ha_cluster_cluster_name }} | ||
- name: "SAP HA Prepare Pacemaker - Set cluster name" | ||
when: | ||
- __sap_ha_pacemaker_cluster_cluster_name is not defined | ||
- sap_ha_pacemaker_cluster_cluster_name is defined | ||
ansible.builtin.set_fact: | ||
__sap_ha_pacemaker_cluster_cluster_name: "{{ ha_cluster_cluster_name | default(sap_ha_pacemaker_cluster_cluster_name) }}" | ||
__sap_ha_pacemaker_cluster_cluster_name: "{{ sap_ha_pacemaker_cluster_cluster_name }}" | ||
|
||
# sap_ha_pacemaker_cluster_hacluster_password -> user-defined or default inherited from {{ ha_cluster_hacluster_password }} | ||
- name: "SAP HA Prepare Pacemaker - Register the 'hacluster' user password" | ||
when: | ||
- __sap_ha_pacemaker_cluster_hacluster_password is not defined | ||
- sap_ha_pacemaker_cluster_hacluster_password | ||
ansible.builtin.set_fact: | ||
__sap_ha_pacemaker_cluster_hacluster_password: "{{ ha_cluster_hacluster_password | default(sap_ha_pacemaker_cluster_hacluster_password) }}" | ||
no_log: true | ||
__sap_ha_pacemaker_cluster_hacluster_password: "{{ sap_ha_pacemaker_cluster_hacluster_password }}" | ||
no_log: true # secure the credential | ||
|
||
|
||
# sap_ha_pacemaker_cluster_extra_packages -> user-defined, empty by global default | ||
# __sap_ha_pacemaker_cluster_sap_extra_packages -> included from vars/* | ||
# __sap_ha_pacemaker_cluster_platform_extra_packages -> included from vars/platform* | ||
# Empty defaults defined here for optional non-user-facing parameters. | ||
|
||
- name: "SAP HA Prepare Pacemaker - Combine extra packages lists" | ||
ansible.builtin.set_fact: | ||
__sap_ha_pacemaker_cluster_extra_packages: "{{ | ||
__sap_ha_pacemaker_cluster_extra_packages: "{{ ( | ||
sap_ha_pacemaker_cluster_extra_packages | ||
+ | ||
sap_ha_pacemaker_cluster_sap_extra_packages | default([]) | ||
+ | ||
sap_ha_pacemaker_cluster_platform_extra_packages | default([]) | ||
}}" | ||
+ __sap_ha_pacemaker_cluster_sap_extra_packages | ||
+ __sap_ha_pacemaker_cluster_platform_extra_packages | ||
) | unique }}" | ||
|
||
|
||
# sap_ha_pacemaker_cluster_fence_agent_minimal_packages -> global default | ||
# sap_ha_pacemaker_cluster_fence_agent_packages -> global default | ||
# __sap_ha_pacemaker_cluster_fence_agent_packages -> internal default (vars/main.yml) | ||
|
||
- name: "SAP HA Prepare Pacemaker - Combine fence agent packages lists" | ||
ansible.builtin.set_fact: | ||
__sap_ha_pacemaker_cluster_fence_agent_packages: "{{ | ||
sap_ha_pacemaker_cluster_fence_agent_packages | ||
+ | ||
__sap_ha_pacemaker_cluster_fence_agent_packages | ||
}}" | ||
__sap_ha_pacemaker_cluster_fence_agent_packages: "{{ ( | ||
sap_ha_pacemaker_cluster_fence_agent_minimal_packages | ||
+ sap_ha_pacemaker_cluster_fence_agent_packages | ||
+ __sap_ha_pacemaker_cluster_fence_agent_packages | ||
) | unique }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
roles/sap_ha_pacemaker_cluster/tasks/import_hacluster_vars_from_inventory.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
--- | ||
# If there are "ha_cluster" Linux System Role parameters already defined in the | ||
# inventory, we will include these custom specifications and they take precedence. | ||
|
||
# Only parameters which need to be adjusted or enhanced by the SAP HA role | ||
# need to be included here. | ||
|
||
|
||
### Take the following template to add additional parameters to be inherited: | ||
# - name: "SAP HA Prepare Pacemaker - Register ha_cluster_" | ||
# ansible.builtin.set_fact: | ||
# __sap_ha_pacemaker_cluster_: "{{ ha_cluster_ }}" | ||
# when: ha_cluster_ is defined | ||
|
||
|
||
# ha_cluster | ||
- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster'" | ||
when: ha_cluster is defined | ||
ansible.builtin.set_fact: | ||
__sap_ha_pacemaker_cluster_ha_cluster: "{{ ha_cluster }}" | ||
|
||
# ha_cluster_cluster_name | ||
- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_cluster_name'" | ||
when: ha_cluster_cluster_name is defined | ||
ansible.builtin.set_fact: | ||
__sap_ha_pacemaker_cluster_cluster_name: "{{ ha_cluster_cluster_name }}" | ||
|
||
# ha_cluster_cluster_properties | ||
- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_cluster_properties'" | ||
when: ha_cluster_cluster_properties is defined | ||
ansible.builtin.set_fact: | ||
__sap_ha_pacemaker_cluster_cluster_properties: "{{ ha_cluster_cluster_properties }}" | ||
|
||
#__sap_ha_pacemaker_cluster_resource_groups ha_cluster_constraints_colocation | ||
- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_constraints_colocation'" | ||
when: ha_cluster_constraints_colocation is defined | ||
ansible.builtin.set_fact: | ||
__sap_ha_pacemaker_cluster_constraints_colocation: "{{ ha_cluster_constraints_colocation }}" | ||
|
||
# ha_cluster_constraints_location | ||
- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_constraints_location'" | ||
when: ha_cluster_constraints_location is defined | ||
ansible.builtin.set_fact: | ||
__sap_ha_pacemaker_cluster_constraints_location: "{{ ha_cluster_constraints_location }}" | ||
|
||
# ha_cluster_constraints_order | ||
- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_constraints_order'" | ||
when: ha_cluster_constraints_order is defined | ||
ansible.builtin.set_fact: | ||
__sap_ha_pacemaker_cluster_constraints_order: "{{ ha_cluster_constraints_order }}" | ||
|
||
# ha_cluster_extra_packages | ||
- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_extra_packages'" | ||
when: ha_cluster_extra_packages is defined | ||
ansible.builtin.set_fact: | ||
__sap_ha_pacemaker_cluster_extra_packages: "{{ ha_cluster_extra_packages }}" | ||
|
||
# ha_cluster_fence_agent_packages | ||
- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_fence_agent_packages'" | ||
when: ha_cluster_fence_agent_packages is defined | ||
ansible.builtin.set_fact: | ||
__sap_ha_pacemaker_cluster_fence_agent_packages: "{{ ha_cluster_fence_agent_packages }}" | ||
|
||
# ha_cluster_hacluster_password | ||
- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_repos'" | ||
when: ha_cluster_hacluster_password is defined | ||
ansible.builtin.set_fact: | ||
__sap_ha_pacemaker_cluster_hacluster_password: "{{ ha_cluster_hacluster_password }}" | ||
no_log: true # handle credentials with care | ||
|
||
# ha_cluster_repos | ||
- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_repos'" | ||
when: ha_cluster_repos is defined | ||
ansible.builtin.set_fact: | ||
__sap_ha_pacemaker_cluster_repos: "{{ ha_cluster_repos }}" | ||
|
||
# ha_cluster_resource_clones | ||
- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_resource_clones'" | ||
when: ha_cluster_resource_clones is defined | ||
ansible.builtin.set_fact: | ||
__sap_ha_pacemaker_cluster_resource_clones: "{{ ha_cluster_resource_clones }}" | ||
|
||
# ha_cluster_resource_groups | ||
- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_resource_groups'" | ||
when: ha_cluster_resource_groups is defined | ||
ansible.builtin.set_fact: | ||
__sap_ha_pacemaker_cluster_resource_groups: "{{ ha_cluster_resource_groups }}" | ||
|
||
# ha_cluster_resource_primitives | ||
- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_resource_primitives'" | ||
when: ha_cluster_resource_primitives is defined | ||
ansible.builtin.set_fact: | ||
__sap_ha_pacemaker_cluster_resource_primitives: "{{ ha_cluster_resource_primitives }}" | ||
no_log: true # be paranoid, there could be credentials in it |
Oops, something went wrong.