diff --git a/roles/sap_general_preconfigure/tasks/main.yml b/roles/sap_general_preconfigure/tasks/main.yml index 3abafab7..0cdd514c 100644 --- a/roles/sap_general_preconfigure/tasks/main.yml +++ b/roles/sap_general_preconfigure/tasks/main.yml @@ -15,13 +15,7 @@ # 5. SLES_SAP_15.6.yml - Specific to distribution SLES_SAP and minor release. - name: Include OS specific vars, specific ansible.builtin.include_vars: "{{ __vars_file }}" - loop: - - "{{ ansible_os_family }}.yml" - - "{{ ansible_distribution ~ '.yml' if ansible_distribution != ansible_os_family else omit }}" - - "{{ __distribution_major_split ~ '.yml' if __distribution_major_split != __distribution_major else omit }}" - - "{{ __distribution_minor_split ~ '.yml' if __distribution_minor_split != __distribution_minor else omit }}" - - "{{ __distribution_major }}.yml" - - "{{ __distribution_minor }}.yml" + loop: "{{ __var_files }}" vars: __vars_file: "{{ role_path }}/vars/{{ item }}" __distribution_major: "{{ ansible_distribution ~ '_' ~ ansible_distribution_major_version }}" @@ -29,6 +23,17 @@ # Enables loading of shared vars between SLES and SLES_SAP __distribution_major_split: "{{ ansible_distribution.split('_')[0] ~ '_' ~ ansible_distribution_major_version }}" __distribution_minor_split: "{{ ansible_distribution.split('_')[0] ~ '_' ~ ansible_distribution_version }}" + __var_files: >- + {{ + [ + ansible_os_family ~ '.yml', + (ansible_distribution ~ '.yml') if ansible_distribution != ansible_os_family else None, + (__distribution_major_split ~ '.yml') if __distribution_major_split != __distribution_major else None, + (__distribution_minor_split ~ '.yml') if __distribution_minor_split != __distribution_minor else None, + __distribution_major ~ '.yml', + __distribution_minor ~ '.yml' + ] | select('defined') | select('string') | list + }} when: __vars_file is file tags: - always diff --git a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_common.yml b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_common.yml index 0d1d1e6f..bdc6ea6d 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_common.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_common.yml @@ -34,13 +34,7 @@ # 5. SLES_SAP_15.6.yml - Specific to distribution SLES_SAP and minor release. - name: "SAP HA Prepare Pacemaker - Include environment specific variables" ansible.builtin.include_vars: "{{ __vars_file }}" - loop: - - "{{ ansible_os_family }}.yml" - - "{{ ansible_distribution ~ '.yml' if ansible_distribution != ansible_os_family else omit }}" - - "{{ __distribution_major_split ~ '.yml' if __distribution_major_split != __distribution_major else omit }}" - - "{{ __distribution_minor_split ~ '.yml' if __distribution_minor_split != __distribution_minor else omit }}" - - "{{ __distribution_major }}.yml" - - "{{ __distribution_minor }}.yml" + loop: "{{ __var_files }}" vars: __vars_file: "{{ role_path }}/vars/{{ item }}" __distribution_major: "{{ ansible_distribution ~ '_' ~ ansible_distribution_major_version }}" @@ -48,4 +42,15 @@ # Enables loading of shared vars between SLES and SLES_SAP __distribution_major_split: "{{ ansible_distribution.split('_')[0] ~ '_' ~ ansible_distribution_major_version }}" __distribution_minor_split: "{{ ansible_distribution.split('_')[0] ~ '_' ~ ansible_distribution_version }}" + __var_files: >- + {{ + [ + ansible_os_family ~ '.yml', + (ansible_distribution ~ '.yml') if ansible_distribution != ansible_os_family else None, + (__distribution_major_split ~ '.yml') if __distribution_major_split != __distribution_major else None, + (__distribution_minor_split ~ '.yml') if __distribution_minor_split != __distribution_minor else None, + __distribution_major ~ '.yml', + __distribution_minor ~ '.yml' + ] | select('defined') | select('string') | list + }} when: __vars_file is file diff --git a/roles/sap_hana_preconfigure/tasks/main.yml b/roles/sap_hana_preconfigure/tasks/main.yml index 91c6dd51..ef63a0b8 100644 --- a/roles/sap_hana_preconfigure/tasks/main.yml +++ b/roles/sap_hana_preconfigure/tasks/main.yml @@ -13,13 +13,7 @@ # 5. SLES_SAP_15.6.yml - Specific to distribution SLES_SAP and minor release. - name: Include OS specific vars, specific ansible.builtin.include_vars: "{{ __vars_file }}" - loop: - - "{{ ansible_os_family }}.yml" - - "{{ ansible_distribution ~ '.yml' if ansible_distribution != ansible_os_family else omit }}" - - "{{ __distribution_major_split ~ '.yml' if __distribution_major_split != __distribution_major else omit }}" - - "{{ __distribution_minor_split ~ '.yml' if __distribution_minor_split != __distribution_minor else omit }}" - - "{{ __distribution_major }}.yml" - - "{{ __distribution_minor }}.yml" + loop: "{{ __var_files }}" vars: __vars_file: "{{ role_path }}/vars/{{ item }}" __distribution_major: "{{ ansible_distribution ~ '_' ~ ansible_distribution_major_version }}" @@ -27,6 +21,17 @@ # Enables loading of shared vars between SLES and SLES_SAP __distribution_major_split: "{{ ansible_distribution.split('_')[0] ~ '_' ~ ansible_distribution_major_version }}" __distribution_minor_split: "{{ ansible_distribution.split('_')[0] ~ '_' ~ ansible_distribution_version }}" + __var_files: >- + {{ + [ + ansible_os_family ~ '.yml', + (ansible_distribution ~ '.yml') if ansible_distribution != ansible_os_family else None, + (__distribution_major_split ~ '.yml') if __distribution_major_split != __distribution_major else None, + (__distribution_minor_split ~ '.yml') if __distribution_minor_split != __distribution_minor else None, + __distribution_major ~ '.yml', + __distribution_minor ~ '.yml' + ] | select('defined') | select('string') | list + }} when: __vars_file is file diff --git a/roles/sap_netweaver_preconfigure/tasks/main.yml b/roles/sap_netweaver_preconfigure/tasks/main.yml index d8d72e32..2f99c60a 100644 --- a/roles/sap_netweaver_preconfigure/tasks/main.yml +++ b/roles/sap_netweaver_preconfigure/tasks/main.yml @@ -13,13 +13,7 @@ # 5. SLES_SAP_15.6.yml - Specific to distribution SLES_SAP and minor release. - name: Include OS specific vars, specific ansible.builtin.include_vars: "{{ __vars_file }}" - loop: - - "{{ ansible_os_family }}.yml" - - "{{ ansible_distribution ~ '.yml' if ansible_distribution != ansible_os_family else omit }}" - - "{{ __distribution_major_split ~ '.yml' if __distribution_major_split != __distribution_major else omit }}" - - "{{ __distribution_minor_split ~ '.yml' if __distribution_minor_split != __distribution_minor else omit }}" - - "{{ __distribution_major }}.yml" - - "{{ __distribution_minor }}.yml" + loop: "{{ __var_files }}" vars: __vars_file: "{{ role_path }}/vars/{{ item }}" __distribution_major: "{{ ansible_distribution ~ '_' ~ ansible_distribution_major_version }}" @@ -27,6 +21,17 @@ # Enables loading of shared vars between SLES and SLES_SAP __distribution_major_split: "{{ ansible_distribution.split('_')[0] ~ '_' ~ ansible_distribution_major_version }}" __distribution_minor_split: "{{ ansible_distribution.split('_')[0] ~ '_' ~ ansible_distribution_version }}" + __var_files: >- + {{ + [ + ansible_os_family ~ '.yml', + (ansible_distribution ~ '.yml') if ansible_distribution != ansible_os_family else None, + (__distribution_major_split ~ '.yml') if __distribution_major_split != __distribution_major else None, + (__distribution_minor_split ~ '.yml') if __distribution_minor_split != __distribution_minor else None, + __distribution_major ~ '.yml', + __distribution_minor ~ '.yml' + ] | select('defined') | select('string') | list + }} when: __vars_file is file tags: - always