Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 4 additions & 4 deletions roles/sap_general_preconfigure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ in variable `sap_general_preconfigure_sap_directories`.<br>

### sap_general_preconfigure_size_of_tmpfs_gb
- _Type:_ `str`
- _Default:_ `"{{ ((0.75 * (ansible_memtotal_mb + ansible_swaptotal_mb)) / 1024) | round | int }}"`
- _Default:_ `"{{ ((0.75 * (ansible_facts['memtotal_mb'] + ansible_facts['swaptotal_mb'])) / 1024) | round | int }}"`

The size of the tmpfs in GB. The formula used here is mentioned in SAP note 941735.<br>

Expand Down Expand Up @@ -433,20 +433,20 @@ The maximum length of the hostname. See SAP note 611361.<br>

### sap_general_preconfigure_hostname
- _Type:_ `str`
- _Default:_ `"{{ ansible_hostname }}"`
- _Default:_ `"{{ ansible_facts['hostname'] }}"`

The hostname to be used for updating or checking `/etc/hosts` entries.<br>

### sap_general_preconfigure_domain
- _Type:_ `str`
- _Default:_ `"{{ ansible_domain }}"`
- _Default:_ `"{{ ansible_facts['domain'] }}"`

The DNS domain name to be used for updating or checking `/etc/hosts` entries.<br>
Mandatory parameter when sap_general_preconfigure_modify_etc_hosts is set to true.<br>

### sap_general_preconfigure_ip
- _Type:_ `str`
- _Default:_ `"{{ ansible_default_ipv4.address }}"`
- _Default:_ `"{{ ansible_facts['default_ipv4'].address }}"`

The IPV4 address to be used for updating or checking `/etc/hosts` entries.<br>

Expand Down
8 changes: 4 additions & 4 deletions roles/sap_general_preconfigure/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ sap_general_preconfigure_modify_selinux_labels: true
# Set to `false` if you do not want to modify the SELinux labels for the SAP directories set
# in variable `sap_general_preconfigure_sap_directories`.

sap_general_preconfigure_size_of_tmpfs_gb: "{{ ((0.75 * (ansible_memtotal_mb + ansible_swaptotal_mb)) / 1024) | round | int }}"
sap_general_preconfigure_size_of_tmpfs_gb: "{{ ((0.75 * (ansible_facts['memtotal_mb'] + ansible_facts['swaptotal_mb'])) / 1024) | round | int }}"
# The size of the tmpfs in GB. The formula used here is mentioned in SAP note 941735.

sap_general_preconfigure_modify_etc_hosts: true
Expand All @@ -167,13 +167,13 @@ sap_general_preconfigure_ignore_dns_failures: true
# report such errors and continue running the role.

# If "global" variables are set, use those. If not, default to the values from gather_facts:
sap_general_preconfigure_ip: "{{ sap_ip | d(ansible_default_ipv4.address) }}"
sap_general_preconfigure_ip: "{{ sap_ip | d(ansible_facts['default_ipv4'].address) }}"
# The IPV4 address to be used for updating or checking `/etc/hosts` entries.

sap_general_preconfigure_hostname: "{{ sap_hostname | d(ansible_hostname) }}"
sap_general_preconfigure_hostname: "{{ sap_hostname | d(ansible_facts['hostname']) }}"
# The hostname to be used for updating or checking `/etc/hosts` entries.

sap_general_preconfigure_domain: "{{ sap_domain | d(ansible_domain) }}"
sap_general_preconfigure_domain: "{{ sap_domain | d(ansible_facts['domain']) }}"
# The DNS domain name to be used for updating or checking `/etc/hosts` entries.
# Mandatory parameter when sap_general_preconfigure_modify_etc_hosts is set to true.

Expand Down
6 changes: 3 additions & 3 deletions roles/sap_general_preconfigure/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@
__sap_general_preconfigure_uefi_boot_dir: /boot/efi/EFI/redhat/grub.cfg
listen: __sap_general_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_general_preconfigure_uefi_boot_dir: /boot/efi/EFI/BOOT/grub.cfg
listen: __sap_general_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_general_preconfigure_reboot_handler
when:
- ansible_os_family == 'Suse'
- ansible_facts['os_family'] == 'Suse'
- sap_general_preconfigure_reboot_ok | d(false)
changed_when: false

Expand Down
8 changes: 4 additions & 4 deletions roles/sap_general_preconfigure/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ argument_specs:
type: bool

sap_general_preconfigure_size_of_tmpfs_gb:
default: "{{ ((0.75 * (ansible_memtotal_mb + ansible_swaptotal_mb)) / 1024) | round | int }}"
default: "{{ ((0.75 * (ansible_facts['memtotal_mb'] + ansible_facts['swaptotal_mb'])) / 1024) | round | int }}"
description:
- The size of the tmpfs in GB. The formula used here is mentioned in SAP note 941735.
required: false
Expand Down Expand Up @@ -340,22 +340,22 @@ argument_specs:
type: str

sap_general_preconfigure_hostname:
default: "{{ ansible_hostname }}"
default: "{{ ansible_facts['hostname'] }}"
description:
- The hostname to be used for updating or checking `/etc/hosts` entries.
required: false
type: str

sap_general_preconfigure_domain:
default: "{{ ansible_domain }}"
default: "{{ ansible_facts['domain'] }}"
description:
- The DNS domain name to be used for updating or checking `/etc/hosts` entries.
- Mandatory parameter when `sap_general_preconfigure_modify_etc_hosts` is set to true.
required: false
type: str

sap_general_preconfigure_ip:
default: "{{ ansible_default_ipv4.address }}"
default: "{{ ansible_facts['default_ipv4'].address }}"
description:
- The IPV4 address to be used for updating or checking `/etc/hosts` entries.
required: false
Expand Down
34 changes: 17 additions & 17 deletions roles/sap_general_preconfigure/tasks/RedHat/assert-installation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
__sap_general_preconfigure_req_ha_repos | list }}"
when:
- sap_general_preconfigure_req_repos is undefined
- ansible_architecture != 's390x'
- ansible_facts['architecture'] != 's390x'

- name: Assert - Set final list of repos, s390x, auto
ansible.builtin.set_fact:
Expand All @@ -44,7 +44,7 @@
__sap_general_preconfigure_req_ha_repos | list }}"
when:
- sap_general_preconfigure_req_repos is undefined
- ansible_architecture == 's390x'
- ansible_facts['architecture'] == 's390x'

- name: Assert - Set final list of repos, manual
ansible.builtin.set_fact:
Expand Down Expand Up @@ -79,24 +79,24 @@

- name: Assert that the RHEL release is locked correctly
ansible.builtin.assert:
that: __sap_general_preconfigure_register_subscription_manager_release_assert.stdout == ansible_distribution_version
that: __sap_general_preconfigure_register_subscription_manager_release_assert.stdout == ansible_facts['distribution_version']
fail_msg: "FAIL: The RHEL release lock status is '{{ __sap_general_preconfigure_register_subscription_manager_release_assert.stdout }}'
but the expected value is '{{ ansible_distribution_version }}'!"
success_msg: "PASS: The RHEL release is correctly locked to '{{ ansible_distribution_version }}'."
but the expected value is '{{ ansible_facts['distribution_version'] }}'!"
success_msg: "PASS: The RHEL release is correctly locked to '{{ ansible_facts['distribution_version'] }}'."
ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(false) }}"
when: "ansible_distribution_version != '7.9'"
when: "ansible_facts['distribution_version'] != '7.9'"

- name: Report that checking the release lock is not necessary if the system is on RHEL 7.9
ansible.builtin.debug:
msg: "INFO: No need to check the release lock setting as the RHEL release {{ ansible_distribution_version }}
is the last RHEL {{ ansible_distribution_major_version }} minor release"
when: "ansible_distribution_version == '7.9'"
msg: "INFO: No need to check the release lock setting as the RHEL release {{ ansible_facts['distribution_version'] }}
is the last RHEL {{ ansible_facts['distribution_major_version'] }} minor release"
when: "ansible_facts['distribution_version'] == '7.9'"

# Reason for noqa: A double brace might also occur in an awk command sequence.
- name: Check RHEL 7 package groups
when:
- sap_general_preconfigure_packagegroups | length > 0
- ansible_distribution_major_version == '7'
- ansible_facts['distribution_major_version'] == '7'
block:

- name: Set yum group list installed command # noqa jinja[spacing]
Expand Down Expand Up @@ -125,7 +125,7 @@
- name: Check RHEL 8 environment groups
when:
- sap_general_preconfigure_envgroups | length > 0
- ansible_distribution_major_version == '8'
- ansible_facts['distribution_major_version'] == '8'
block:

- name: Set yum envgroup list installed command # noqa jinja[spacing]
Expand Down Expand Up @@ -169,7 +169,7 @@
register: __sap_general_preconfigure_register_required_ppc64le_packages_assert
changed_when: false
when:
- ansible_architecture == "ppc64le"
- ansible_facts['architecture'] == "ppc64le"
- sap_general_preconfigure_install_ibm_power_tools
ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(false) }}"

Expand All @@ -183,7 +183,7 @@
loop_control:
loop_var: line_item
when:
- ansible_architecture == "ppc64le"
- ansible_facts['architecture'] == "ppc64le"
- sap_general_preconfigure_install_ibm_power_tools
ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(false) }}"

Expand Down Expand Up @@ -280,20 +280,20 @@
- name: "Assert - Set needs-restarting command in case of RHEL 7"
ansible.builtin.set_fact:
__sap_general_preconfigure_fact_needs_restarting_command_assert: "needs-restarting -r"
when: ansible_distribution_major_version == '7'
when: ansible_facts['distribution_major_version'] == '7'

- name: "Assert - Set needs-restarting command in case of RHEL 8 or greater, except RHEL 8.0"
ansible.builtin.set_fact:
__sap_general_preconfigure_fact_needs_restarting_command_assert: "yum needs-restarting -r"
when:
- ansible_distribution_major_version | int >= 8
- ansible_distribution_version != '8.0'
- ansible_facts['distribution_major_version'] | int >= 8
- ansible_facts['distribution_version'] != '8.0'

- name: "Assert - Set customized needs-restarting command in case of RHEL 8.0"
ansible.builtin.set_fact:
__sap_general_preconfigure_fact_needs_restarting_command_assert: "_IKRNL=$(rpm -q --last kernel | awk 'NR==1{sub(/kernel-/,\"\"); print $1}');
_CKRNL=$(uname -r); if [ ${_IKRNL} != ${_CKRNL} ]; then exit 1; else exit 0; fi"
when: ansible_distribution_version == '8.0'
when: ansible_facts['distribution_version'] == '8.0'

- name: Assert - Display the command for checking a reboot requirement
ansible.builtin.debug:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

- name: Assert that the DNS domain is set
ansible.builtin.assert:
that: not( (ansible_domain is undefined) or (ansible_domain is none) or (ansible_domain | trim == '') )
that: not( (ansible_facts['domain'] is undefined) or (ansible_facts['domain'] is none) or (ansible_facts['domain'] | trim == '') )
fail_msg: "FAIL: The DNS domain is not configured! So variable 'sap_general_preconfigure_domain' needs to be configured!"
success_msg: "PASS: The DNS domain is configured."
# ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(false) }}"
Expand All @@ -29,11 +29,11 @@
changed_when: false
when: "'bind-utils' in ansible_facts.packages"

- name: Assert that ansible_default_ipv4.address is set
- name: Assert that ansible_facts['default_ipv4'].address is set
ansible.builtin.assert:
that: not( (ansible_default_ipv4.address is undefined) or (ansible_default_ipv4.address is none) or (ansible_default_ipv4.address | trim == '') )
fail_msg: "FAIL: The variable 'ansible_default_ipv4.address' is not defined!"
success_msg: "PASS: The variable 'ansible_default_ipv4.address' is defined."
that: not( (ansible_facts['default_ipv4'].address is undefined) or (ansible_facts['default_ipv4'].address is none) or (ansible_facts['default_ipv4'].address | trim == '') )
fail_msg: "FAIL: The variable 'ansible_facts['default_ipv4'].address' is not defined!"
success_msg: "PASS: The variable 'ansible_facts['default_ipv4'].address' is defined."
ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(false) }}"

- name: Assert that sap_general_preconfigure_ip is set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
name: policycoreutils-python-utils
when:
- sap_general_preconfigure_modify_selinux_labels
- ansible_distribution_major_version != '7'
- ansible_facts['distribution_major_version'] != '7'

- name: Check if the directory '/usr/sap' exists
ansible.builtin.stat:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@

- name: Set or unset SELinux kernel parameter, RHEL >= 8
when:
- ansible_os_family == 'RedHat'
- ansible_distribution_major_version | int >= 8
- ansible_facts['os_family'] == 'RedHat'
- ansible_facts['distribution_major_version'] | int >= 8
block:

- name: SELinux - Examine grub entries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
group: root
mode: '0644'
backup: true
when: ansible_distribution_major_version | int <= 8
when: ansible_facts['distribution_major_version'] | int <= 8

- name: Copy file /etc/tmpfiles.d/sap.conf, RHEL 9 and later
ansible.builtin.copy:
Expand All @@ -19,4 +19,4 @@
group: root
mode: '0644'
backup: true
when: ansible_distribution_major_version | int >= 9
when: ansible_facts['distribution_major_version'] | int >= 9
30 changes: 15 additions & 15 deletions roles/sap_general_preconfigure/tasks/RedHat/installation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
__sap_general_preconfigure_req_ha_repos | list }}"
when:
- sap_general_preconfigure_req_repos is undefined
- ansible_architecture != 's390x'
- ansible_facts['architecture'] != 's390x'

- name: Set final list of repos, s390x, auto
ansible.builtin.set_fact:
Expand All @@ -44,7 +44,7 @@
__sap_general_preconfigure_req_ha_repos | list }}"
when:
- sap_general_preconfigure_req_repos is undefined
- ansible_architecture == 's390x'
- ansible_facts['architecture'] == 's390x'

- name: Set final list of repos, manual
ansible.builtin.set_fact:
Expand Down Expand Up @@ -106,21 +106,21 @@
msg: "The RHEL minor release lock is set correctly to '{{ __sap_general_preconfigure_register_subscription_manager_release.stdout }}'."
when:
- sap_general_preconfigure_set_minor_release
- __sap_general_preconfigure_register_subscription_manager_release.stdout == ansible_distribution_version
- __sap_general_preconfigure_register_subscription_manager_release.stdout == ansible_facts['distribution_version']

# Reason for noqa: Finding out if the minor release has already been set would require one more task.
- name: Set the minor RHEL release # noqa no-changed-when
ansible.builtin.command: subscription-manager release --set="{{ ansible_distribution_version }}"
ansible.builtin.command: subscription-manager release --set="{{ ansible_facts['distribution_version'] }}"
when:
- sap_general_preconfigure_set_minor_release
- __sap_general_preconfigure_register_subscription_manager_release.stdout != ansible_distribution_version
- __sap_general_preconfigure_register_subscription_manager_release.stdout != ansible_facts['distribution_version']
tags: molecule-idempotence-notest

- name: Ensure that the required package groups are installed, RHEL except 8.1
ansible.builtin.package:
name: "{{ sap_general_preconfigure_packagegroups }}"
state: present
when: ansible_distribution_version != '8.1'
when: ansible_facts['distribution_version'] != '8.1'

# Note: We do not want package updates, see also Red Hat bug 1983749.
# Because the installation of an environment or package group is not guaranteed to avoid package updates,
Expand All @@ -130,7 +130,7 @@
- name: Ensure that the required package groups are installed, RHEL 8.1 # noqa command-instead-of-module no-changed-when
ansible.builtin.command: "yum install {{ sap_general_preconfigure_packagegroups | join(' ') }} --nobest --exclude=kernel* -y"
register: __sap_general_preconfigure_register_yum_group_install
when: ansible_distribution_version == '8.1'
when: ansible_facts['distribution_version'] == '8.1'
tags: molecule-idempotence-notest

# possible replacement once we no longer need Ansible 2.9 compatibility:
Expand All @@ -140,7 +140,7 @@
# state: present
# nobest: true # supported from Ansible 2.11
# register: __sap_general_preconfigure_register_yum_group_install
# when: ansible_distribution_major_version == '8' or ansible_distribution_major_version == '9'
# when: ansible_facts['distribution_major_version'] == '8' or ansible_facts['distribution_major_version'] == '9'

- name: Ensure that the required packages are installed
ansible.builtin.package:
Expand All @@ -153,15 +153,15 @@
state: present
disable_gpg_check: True
when:
- ansible_architecture == "ppc64le"
- ansible_facts['architecture'] == "ppc64le"
- sap_general_preconfigure_install_ibm_power_tools | d(true)
- sap_general_preconfigure_add_ibm_power_repo | d(true)

- name: Accept the license for the IBM Service and Productivity Tools
ansible.builtin.shell: LESS=+q /opt/ibm/lop/configure <<<'y'
changed_when: true
when:
- ansible_architecture == "ppc64le"
- ansible_facts['architecture'] == "ppc64le"
- sap_general_preconfigure_install_ibm_power_tools | d(true)
- sap_general_preconfigure_add_ibm_power_repo | d(true)

Expand All @@ -171,7 +171,7 @@
state: latest
name: "{{ __sap_general_preconfigure_required_ppc64le }}"
when:
- ansible_architecture == "ppc64le"
- ansible_facts['architecture'] == "ppc64le"
- sap_general_preconfigure_install_ibm_power_tools | d(true)

- name: Ensure that the minimum required package versions are installed
Expand Down Expand Up @@ -243,20 +243,20 @@
- name: "Set needs-restarting command in case of RHEL 7"
ansible.builtin.set_fact:
__sap_general_preconfigure_fact_needs_restarting_command: "needs-restarting -r"
when: ansible_distribution_major_version == '7'
when: ansible_facts['distribution_major_version'] == '7'

- name: "Set needs-restarting command in case of RHEL 8 or greater, except RHEL 8.0"
ansible.builtin.set_fact:
__sap_general_preconfigure_fact_needs_restarting_command: "yum needs-restarting -r"
when:
- ansible_distribution_major_version | int >= 8
- ansible_distribution_version != '8.0'
- ansible_facts['distribution_major_version'] | int >= 8
- ansible_facts['distribution_version'] != '8.0'

- name: "Set customized needs-restarting command in case of RHEL 8.0"
ansible.builtin.set_fact:
__sap_general_preconfigure_fact_needs_restarting_command: "_IKRNL=$(rpm -q --last kernel | awk 'NR==1{sub(/kernel-/,\"\"); print $1}');
_CKRNL=$(uname -r); if [ ${_IKRNL} != ${_CKRNL} ]; then exit 1; else exit 0; fi"
when: ansible_distribution_version == '8.0'
when: ansible_facts['distribution_version'] == '8.0'

- name: Display the command for checking a reboot requirement
ansible.builtin.debug:
Expand Down
Loading
Loading