Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 3 additions & 3 deletions roles/sap_netweaver_preconfigure/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@
__sap_netweaver_preconfigure_uefi_boot_dir: /boot/efi/EFI/redhat/grub.cfg
listen: __sap_netweaver_preconfigure_regenerate_grub2_conf_handler
when:
- ansible_distribution == 'RedHat'
- ansible_facts['distribution'] == 'RedHat'

- name: "Set the grub.cfg location SLES"
ansible.builtin.set_fact:
__sap_netweaver_preconfigure_uefi_boot_dir: /boot/efi/EFI/BOOT/grub.cfg
listen: __sap_netweaver_preconfigure_regenerate_grub2_conf_handler
when:
- ansible_distribution == 'SLES' or ansible_distribution == 'SLES_SAP'
- ansible_facts['distribution'] == 'SLES' or ansible_facts['distribution'] == 'SLES_SAP'

- name: "Run grub-mkconfig (UEFI mode)"
ansible.builtin.command:
Expand Down Expand Up @@ -97,7 +97,7 @@
timeout: 30
listen: __sap_netweaver_preconfigure_reboot_handler
when:
- ansible_os_family == 'Suse'
- ansible_facts['os_family'] == 'Suse'
- sap_netweaver_preconfigure_reboot_ok | d(false)
changed_when: false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
- name: Assert that enough swap space is configured
ansible.builtin.assert:
that:
- (ansible_swaptotal_mb | int) >= (sap_netweaver_preconfigure_min_swap_space_mb | int)
fail_msg: "FAIL: The system has only {{ ansible_swaptotal_mb }} MB of swap space configured,
- (ansible_facts['swaptotal_mb'] | int) >= (sap_netweaver_preconfigure_min_swap_space_mb | int)
fail_msg: "FAIL: The system has only {{ ansible_facts['swaptotal_mb'] }} MB of swap space configured,
which is less than the minimum required amount of {{ sap_netweaver_preconfigure_min_swap_space_mb }} MB for SAP NetWeaver!"
success_msg: "PASS: The system has {{ ansible_swaptotal_mb }} MB of swap space configured,
success_msg: "PASS: The system has {{ ansible_facts['swaptotal_mb'] }} MB of swap space configured,
which is equal to or more than the minimum required amount of {{ sap_netweaver_preconfigure_min_swap_space_mb }} MB for SAP NetWeaver."
when: sap_netweaver_preconfigure_fail_if_not_enough_swap_space_configured
ignore_errors: "{{ sap_netweaver_preconfigure_assert_ignore_errors | d(false) }}"
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@
- name: Warn if not enough swap space is configured
ansible.builtin.fail:
msg: |
The system has only {{ ansible_swaptotal_mb }} MB of swap space configured,
The system has only {{ ansible_facts['swaptotal_mb'] }} MB of swap space configured,
which is less than the minimum required amount of {{ sap_netweaver_preconfigure_min_swap_space_mb }} MB for SAP NetWeaver!
ignore_errors: true
when:
- ansible_swaptotal_mb < sap_netweaver_preconfigure_min_swap_space_mb|int
- ansible_facts['swaptotal_mb'] < sap_netweaver_preconfigure_min_swap_space_mb|int
- not sap_netweaver_preconfigure_fail_if_not_enough_swap_space_configured|d(true)

- name: Fail if not enough swap space is configured
ansible.builtin.fail:
msg: |
The system has only {{ ansible_swaptotal_mb }} MB of swap space configured,
The system has only {{ ansible_facts['swaptotal_mb'] }} MB of swap space configured,
which is less than the minimum required amount of {{ sap_netweaver_preconfigure_min_swap_space_mb }} MB for SAP NetWeaver!
when:
- ansible_swaptotal_mb < sap_netweaver_preconfigure_min_swap_space_mb|int
- ansible_facts['swaptotal_mb'] < sap_netweaver_preconfigure_min_swap_space_mb|int
- sap_netweaver_preconfigure_fail_if_not_enough_swap_space_configured|d(true)
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
state: present
name: "{{ __sap_netweaver_preconfigure_adobe_doc_services_packages }}"
when:
- ansible_architecture == 'x86_64'
- ansible_facts['architecture'] == 'x86_64'
- sap_netweaver_preconfigure_use_adobe_doc_services
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@

- name: Assert that adequate swap is configured
ansible.builtin.assert:
that: ansible_swaptotal_mb > (sap_netweaver_preconfigure_min_swap_space_mb | int)
that: ansible_facts['swaptotal_mb'] > (sap_netweaver_preconfigure_min_swap_space_mb | int)
fail_msg: "FAIL: A minimum of {{ sap_netweaver_preconfigure_min_swap_space_mb
}}MiB is required but only {{ ansible_swaptotal_mb }}MiB was discovered"
}}MiB is required but only {{ ansible_facts['swaptotal_mb'] }}MiB was discovered"
success_msg: "PASS: the system has at least {{ sap_netweaver_preconfigure_min_swap_space_mb
}}MiB of swap configured"
when: sap_netweaver_preconfigure_fail_if_not_enough_swap_space_configured
8 changes: 4 additions & 4 deletions roles/sap_netweaver_preconfigure/tasks/SLES/configuration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,19 @@

- name: Warn if not enough swap space is configured
ansible.builtin.fail:
msg: "WARN: The system has only {{ ansible_swaptotal_mb }} MB of swap space configured,
msg: "WARN: The system has only {{ ansible_facts['swaptotal_mb'] }} MB of swap space configured,
which is less than the minimum required amount of {{ sap_netweaver_preconfigure_min_swap_space_mb
}} MB for SAP NetWeaver!"
ignore_errors: true
when:
- ansible_swaptotal_mb < sap_netweaver_preconfigure_min_swap_space_mb|int
- ansible_facts['swaptotal_mb'] < sap_netweaver_preconfigure_min_swap_space_mb|int
- not sap_netweaver_preconfigure_fail_if_not_enough_swap_space_configured|d(true)

- name: Fail if not enough swap space is configured
ansible.builtin.fail:
msg: "FAIL: The system has only {{ ansible_swaptotal_mb }} MB of swap space configured,
msg: "FAIL: The system has only {{ ansible_facts['swaptotal_mb'] }} MB of swap space configured,
which is less than the minimum required amount of {{ sap_netweaver_preconfigure_min_swap_space_mb
}} MB for SAP NetWeaver!"
when:
- ansible_swaptotal_mb < sap_netweaver_preconfigure_min_swap_space_mb|int
- ansible_facts['swaptotal_mb'] < sap_netweaver_preconfigure_min_swap_space_mb|int
- sap_netweaver_preconfigure_fail_if_not_enough_swap_space_configured|d(true)
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
__sap_netweaver_preconfigure_use_saptune: false
when:
- '"SLES_SAP" not in __sap_netweaver_preconfigure_register_baseproduct.stat.lnk_target'
- '"SLES" in __sap_netweaver_preconfigure_register_baseproduct.stat.lnk_target
and ansible_distribution_major_version | int < 16'
- '"SLES" in __sap_netweaver_preconfigure_register_baseproduct.stat.lnk_target'
- ansible_facts['distribution_major_version'] | int < 16


- name: Block to ensure saptune is installed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
- __sap_netweaver_preconfigure_use_saptune
- __sap_netweaver_preconfigure_register_saptune_check_before.rc != 0
# sapconf is not present on SLES 16 and takeover is not required.
- ansible_distribution_major_version | int < 16
- ansible_facts['distribution_major_version'] | int < 16
block:
- name: Check saptune version # noqa: command-instead-of-module
ansible.builtin.command:
Expand Down
20 changes: 10 additions & 10 deletions roles/sap_netweaver_preconfigure/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
loop: "{{ __var_files }}"
vars:
__vars_file: "{{ role_path }}/vars/{{ item }}"
__distribution_major: "{{ ansible_distribution ~ '_' ~ ansible_distribution_major_version }}"
__distribution_minor: "{{ ansible_distribution ~ '_' ~ ansible_distribution_version }}"
__distribution_major: "{{ ansible_facts['distribution'] ~ '_' ~ ansible_facts['distribution_major_version'] }}"
__distribution_minor: "{{ ansible_facts['distribution'] ~ '_' ~ ansible_facts['distribution_version'] }}"
# 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 }}"
__distribution_major_split: "{{ ansible_facts['distribution'].split('_')[0] ~ '_' ~ ansible_facts['distribution_major_version'] }}"
__distribution_minor_split: "{{ ansible_facts['distribution'].split('_')[0] ~ '_' ~ ansible_facts['distribution_version'] }}"
__var_files: >-
{{
[
ansible_os_family ~ '.yml',
(ansible_distribution ~ '.yml') if ansible_distribution != ansible_os_family else None,
ansible_facts['os_family'] ~ '.yml',
(ansible_facts['distribution'] ~ '.yml') if ansible_facts['distribution'] != ansible_facts['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',
Expand All @@ -52,12 +52,12 @@
ansible.builtin.include_tasks: '{{ item }}/{{ __sap_netweaver_preconfigure_fact_assert_filename_prefix }}installation.yml'
when: sap_netweaver_preconfigure_config_all|d(true) or sap_netweaver_preconfigure_installation|d(false)
with_first_found:
- '{{ ansible_distribution.split("_")[0] }}'
- '{{ ansible_distribution }}'
- "{{ ansible_facts['distribution'].split('_')[0] }}"
- "{{ ansible_facts['distribution'] }}"

- name: Include tasks from 'configuration.yml'
ansible.builtin.include_tasks: '{{ item }}/{{ __sap_netweaver_preconfigure_fact_assert_filename_prefix }}configuration.yml'
when: sap_netweaver_preconfigure_config_all|d(true) or sap_netweaver_preconfigure_configuration|d(false)
with_first_found:
- '{{ ansible_distribution.split("_")[0] }}'
- '{{ ansible_distribution }}'
- "{{ ansible_facts['distribution'].split('_')[0] }}"
- "{{ ansible_facts['distribution'] }}"
2 changes: 1 addition & 1 deletion roles/sap_netweaver_preconfigure/vars/SLES_15.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ __sap_netweaver_preconfigure_packages:

# Recommended for System monitoring
- cpupower
- "{{ 'libcpupower0' if ansible_distribution_version is version('15.6', '<') else 'libcpupower1' }}"
- "{{ 'libcpupower0' if ansible_facts['distribution_version'] is version('15.6', '<') else 'libcpupower1' }}"
- libsensors4

# Additional packages
Expand Down
2 changes: 1 addition & 1 deletion roles/sap_netweaver_preconfigure/vars/SLES_SAP_15.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ __sap_netweaver_preconfigure_packages:

# Recommended for System monitoring
- cpupower
- "{{ 'libcpupower0' if ansible_distribution_version is version('15.6', '<') else 'libcpupower1' }}"
- "{{ 'libcpupower0' if ansible_facts['distribution_version'] is version('15.6', '<') else 'libcpupower1' }}"
- libsensors4

# Additional packages
Expand Down
Loading