Skip to content

Commit

Permalink
Merge pull request #559 from berndfinger/issue-555-sap_hana_preconfigure
Browse files Browse the repository at this point in the history
sap_hana_preconfigure: Support Ansible 2.16.1
  • Loading branch information
berndfinger authored Jan 3, 2024
2 parents cd820d5 + 17bd6f2 commit e0dedd4
Show file tree
Hide file tree
Showing 18 changed files with 117 additions and 70 deletions.
12 changes: 6 additions & 6 deletions roles/sap_hana_preconfigure/tasks/RedHat/assert-installation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- name: Assert that the system is running a RHEL release which is supported for SAP HANA
ansible.builtin.assert:
that: ansible_distribution_version in "{{ sap_hana_preconfigure_supported_rhel_minor_releases }}"
that: ansible_distribution_version in sap_hana_preconfigure_supported_rhel_minor_releases
fail_msg:
- "FAIL: The RHEL release '{{ ansible_distribution_version }}' may not (yet) be supported for SAP HANA. Please check SAP note 2235581!"
- "NOTE: If necessary, adapt role parameter `sap_hana_preconfigure_supported_rhel_minor_releases` accordingly."
Expand All @@ -12,7 +12,7 @@

- name: Report if the RHEL release is supported for SAP HANA
ansible.builtin.assert:
that: ansible_distribution_version in "{{ sap_hana_preconfigure_supported_rhel_minor_releases }}"
that: ansible_distribution_version in sap_hana_preconfigure_supported_rhel_minor_releases
fail_msg:
- "WARN: The RHEL release '{{ ansible_distribution_version }}' may not (yet) be supported for SAP HANA. Please check SAP note 2235581!"
- "NOTE: If necessary, adapt role parameter `sap_hana_preconfigure_supported_rhel_minor_releases` accordingly."
Expand All @@ -33,7 +33,7 @@

- name: Assert that all required repos are enabled
ansible.builtin.assert:
that: "'{{ line_item }}' in __sap_hana_preconfigure_register_enabled_repos_assert.stdout_lines"
that: line_item in __sap_hana_preconfigure_register_enabled_repos_assert.stdout_lines
fail_msg: "FAIL: Repository '{{ line_item }}' is not enabled!"
success_msg: "PASS: Repository '{{ line_item }}' is enabled."
with_items:
Expand All @@ -54,7 +54,7 @@

- name: Assert that the RHEL release is locked correctly
ansible.builtin.assert:
that: "__sap_hana_preconfigure_register_subscription_manager_release_assert.stdout == '{{ ansible_distribution_version }}'"
that: __sap_hana_preconfigure_register_subscription_manager_release_assert.stdout == ansible_distribution_version
fail_msg: "FAIL: The RHEL release lock status is '{{ __sap_hana_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 }}'."
Expand All @@ -69,7 +69,7 @@

- name: Assert that all required packages are installed
ansible.builtin.assert:
that: "'{{ line_item }}' in ansible_facts.packages"
that: line_item in ansible_facts.packages
fail_msg: "FAIL: Package '{{ line_item }}' is not installed!"
success_msg: "PASS: Package '{{ line_item }}' is installed."
with_items:
Expand All @@ -95,7 +95,7 @@

- name: Assert that all required IBM packages are installed
ansible.builtin.assert:
that: "'{{ line_item }}' in __sap_hana_preconfigure_register_required_ppc64le_packages_assert.stdout_lines"
that: line_item in __sap_hana_preconfigure_register_required_ppc64le_packages_assert.stdout_lines
fail_msg: "FAIL: Package '{{ line_item }}' is not installed!"
success_msg: "PASS: Package '{{ line_item }}' is installed."
with_items:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@
ignore_errors: yes
when: __sap_hana_preconfigure_register_stat_sysctl_ibm_largesend_conf_assert.stat.exists

# needed because line_item.value is not evaluated correctly in the that: statement
- name: 2055470 - Set fact for line_item.value
ansible.builtin.set_fact:
__sap_hana_preconfigure_sysctl_value_2055470: "{{ line_item.value }}"

- name: 2055470 - Assert that {{ line_item.name }} is set correctly in /etc/sysctl.d/ibm_largesend.conf
ansible.builtin.assert:
that: "__sap_hana_preconfigure_register_sysctl_ibm_largesend_conf_parameter_assert.stdout == '{{ line_item.value }}'"
that: __sap_hana_preconfigure_register_sysctl_ibm_largesend_conf_parameter_assert.stdout == __sap_hana_preconfigure_sysctl_value_2055470
fail_msg: "FAIL: The value of '{{ line_item.name }}' in /etc/sysctl.d/ibm_largesend.conf is
'{{ __sap_hana_preconfigure_register_sysctl_ibm_largesend_conf_parameter_assert.stdout }}' but the expected value is 'line_item.value'!"
success_msg: "PASS: The value of '{{ line_item.name }}' in /etc/sysctl.d/ibm_largesend.conf is
Expand All @@ -27,7 +32,7 @@

- name: 2055470 - Assert that {{ line_item.name }} is set correctly as per sysctl
ansible.builtin.assert:
that: "__sap_hana_preconfigure_register_sysctl_ibm_parameter_assert.stdout == '{{ line_item.value }}'"
that: __sap_hana_preconfigure_register_sysctl_ibm_parameter_assert.stdout == __sap_hana_preconfigure_sysctl_value_2055470
fail_msg: "FAIL: The current value of '{{ line_item.name }}' as per sysctl is
'{{ __sap_hana_preconfigure_register_sysctl_ibm_parameter_assert.stdout }}' but the expected value is '{{ line_item.value }}'!"
success_msg: "PASS: The current value of '{{ line_item.name }}' as per sysctl is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@
ignore_errors: yes
when: __sap_hana_preconfigure_register_stat_sysctl_saphana_conf_assert.stat.exists

# needed because line_item.value is not evaluated correctly in the that: statement
- name: 2382421 - Set fact for line_item.value
ansible.builtin.set_fact:
__sap_hana_preconfigure_sysctl_value_2382421: "{{ line_item.value }}"

- name: 2382421 - Assert that {{ line_item.name }} is set correctly in {{ __sap_hana_preconfigure_etc_sysctl_saphana_conf }}
ansible.builtin.assert:
that: "__sap_hana_preconfigure_register_sysctl_saphana_conf_network_parameter_assert.stdout == '{{ line_item.value }}'"
that: __sap_hana_preconfigure_register_sysctl_saphana_conf_network_parameter_assert.stdout == __sap_hana_preconfigure_sysctl_value_2382421
fail_msg: "FAIL: The value of '{{ line_item.name }}' in {{ __sap_hana_preconfigure_etc_sysctl_saphana_conf }} is
'{{ __sap_hana_preconfigure_register_sysctl_saphana_conf_network_parameter_assert.stdout }}' but the expected value is 'line_item.value'!"
success_msg: "PASS: The value of '{{ line_item.name }}' in {{ __sap_hana_preconfigure_etc_sysctl_saphana_conf }} is
Expand All @@ -27,7 +32,7 @@

- name: 2382421 - Assert that {{ line_item.name }} is set correctly as per sysctl
ansible.builtin.assert:
that: "__sap_hana_preconfigure_register_sysctl_network_parameter_assert.stdout == '{{ line_item.value }}'"
that: __sap_hana_preconfigure_register_sysctl_network_parameter_assert.stdout == __sap_hana_preconfigure_sysctl_value_2382421
fail_msg: "FAIL: The current value of '{{ line_item.name }}' as per sysctl is
'{{ __sap_hana_preconfigure_register_sysctl_network_parameter_assert.stdout }}' but the expected value is '{{ line_item.value }}'!"
success_msg: "PASS: The current value of '{{ line_item.name }}' as per sysctl is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

- name: Assert that there is an entry for '{{ line_item }}' in the SELinux configuration database
ansible.builtin.assert:
that: __sap_hana_preconfigure_register_semanage_fcontext_hana.stdout | int != 0
that: (__sap_hana_preconfigure_register_semanage_fcontext_hana.stdout | int) != 0
fail_msg: "FAIL: There is no entry for '{{ line_item }}' in the SELinux configuration database!"
success_msg: "PASS: There is an entry for '{{ line_item }}' in the SELinux configuration database."
ignore_errors: "{{ sap_hana_preconfigure_assert_ignore_errors | d(false) }}"
Expand All @@ -35,7 +35,7 @@

- name: Assert that all files in '{{ line_item }}' and below have the 'usr_t' file context
ansible.builtin.assert:
that: __sap_hana_preconfigure_register_ls_z_hana.stdout | int == 0
that: (__sap_hana_preconfigure_register_ls_z_hana.stdout | int) == 0
fail_msg: "FAIL: There is at least one file in '{{ line_item }}' or below without the 'usr_t' file context!"
success_msg: "PASS: All files in '{{ line_item }}' and below have the 'usr_t' file context."
ignore_errors: "{{ sap_hana_preconfigure_assert_ignore_errors | d(false) }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@
ignore_errors: yes
when: __sap_hana_preconfigure_register_etc_sysctl_netapp_hana_conf_assert.stat.exists

# needed because line_item.value is not evaluated correctly in the that: statement
- name: 3024346 - Set fact for line_item.value
ansible.builtin.set_fact:
__sap_hana_preconfigure_sysctl_value_3024346: "{{ line_item.value }}"

- name: 3024346 - Assert that {{ line_item.name }} is set correctly in {{ __sap_hana_preconfigure_etc_sysctl_netapp_hana_conf }}
ansible.builtin.assert:
that: "__sap_hana_preconfigure_register_sysctl_netapp_hana_conf_network_parameter_assert.stdout == '{{ line_item.value }}'"
that: __sap_hana_preconfigure_register_sysctl_netapp_hana_conf_network_parameter_assert.stdout == __sap_hana_preconfigure_sysctl_value_3024346
fail_msg: "FAIL: The value of '{{ line_item.name }}' in '{{ __sap_hana_preconfigure_etc_sysctl_saphana_conf }}' is
'{{ __sap_hana_preconfigure_register_sysctl_netapp_hana_conf_network_parameter_assert.stdout }}' but the expected value is 'line_item.value'!"
success_msg: "PASS: The value of '{{ line_item.name }}' in '{{ __sap_hana_preconfigure_etc_sysctl_saphana_conf }}' is
Expand All @@ -27,7 +32,7 @@

- name: 3024346 - Assert that {{ line_item.name }} is set correctly as per sysctl
ansible.builtin.assert:
that: "__sap_hana_preconfigure_register_sysctl_netapp_hana_network_parameter_assert.stdout == '{{ line_item.value }}'"
that: __sap_hana_preconfigure_register_sysctl_netapp_hana_network_parameter_assert.stdout == __sap_hana_preconfigure_sysctl_value_3024346
fail_msg: "FAIL: The current value of '{{ line_item.name }}' as per sysctl is
'{{ __sap_hana_preconfigure_register_sysctl_netapp_hana_network_parameter_assert.stdout }}' but the expected value is '{{ line_item.value }}'!"
success_msg: "PASS: The current value of '{{ line_item.name }}' as per sysctl is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,11 @@
- name: Assert that service abrt-ccpp is disabled, and inactive or stopped
ansible.builtin.include_tasks: assert-services.yml
vars:
line_item: abrt-ccpp
__sap_hana_preconfigure_service_status: "{{ ansible_facts.services['abrt-ccpp.service'].status }}"
__sap_hana_preconfigure_service_state: "{{ ansible_facts.services['abrt-ccpp.service'].state }}"
__sap_hana_preconfigure_packages_and_services_pkg: "{{ __sap_hana_preconfigure_packages_and_services['abrt-ccpp']['pkg'] }}"
__sap_hana_preconfigure_packages_and_services_svc: "{{ __sap_hana_preconfigure_packages_and_services['abrt-ccpp']['svc'] }}"
__sap_hana_preconfigure_packages_and_services_svc_status: "{{ __sap_hana_preconfigure_packages_and_services['abrt-ccpp']['svc_status'] }}"
__sap_hana_preconfigure_packages_and_services_svc_state: "{{ __sap_hana_preconfigure_packages_and_services['abrt-ccpp']['svc_state'] }}"
__sap_hana_preconfigure_packages_and_services_systemd_enabled: "{{ __sap_hana_preconfigure_packages_and_services['abrt-ccpp']['systemd_enabled'] }}"
__sap_hana_preconfigure_packages_and_services_systemd_state: "{{ __sap_hana_preconfigure_packages_and_services['abrt-ccpp']['systemd_state'] }}"
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,11 @@
- name: Assert that service abrtd is disabled, and inactive or stopped
ansible.builtin.include_tasks: assert-services.yml
vars:
line_item: abrtd
__sap_hana_preconfigure_service_status: "{{ ansible_facts.services['abrtd.service'].status }}"
__sap_hana_preconfigure_service_state: "{{ ansible_facts.services['abrtd.service'].state }}"
__sap_hana_preconfigure_packages_and_services_pkg: "{{ __sap_hana_preconfigure_packages_and_services['abrtd']['pkg'] }}"
__sap_hana_preconfigure_packages_and_services_svc: "{{ __sap_hana_preconfigure_packages_and_services['abrtd']['svc'] }}"
__sap_hana_preconfigure_packages_and_services_svc_status: "{{ __sap_hana_preconfigure_packages_and_services['abrtd']['svc_status'] }}"
__sap_hana_preconfigure_packages_and_services_svc_state: "{{ __sap_hana_preconfigure_packages_and_services['abrtd']['svc_state'] }}"
__sap_hana_preconfigure_packages_and_services_systemd_enabled: "{{ __sap_hana_preconfigure_packages_and_services['abrtd']['systemd_enabled'] }}"
__sap_hana_preconfigure_packages_and_services_systemd_state: "{{ __sap_hana_preconfigure_packages_and_services['abrtd']['systemd_state'] }}"
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@
- name: Assert that service numad is disabled, and inactive or stopped, if tuned is not to be used
ansible.builtin.include_tasks: assert-services.yml
vars:
line_item: numad
__sap_hana_preconfigure_service_status: "{{ ansible_facts.services['numad.service'].status }}"
__sap_hana_preconfigure_service_state: "{{ ansible_facts.services['numad.service'].state }}"
__sap_hana_preconfigure_packages_and_services_pkg: "{{ __sap_hana_preconfigure_packages_and_services['numad']['pkg'] }}"
__sap_hana_preconfigure_packages_and_services_svc: "{{ __sap_hana_preconfigure_packages_and_services['numad']['svc'] }}"
__sap_hana_preconfigure_packages_and_services_svc_status: "{{ __sap_hana_preconfigure_packages_and_services['numad']['svc_status'] }}"
__sap_hana_preconfigure_packages_and_services_svc_state: "{{ __sap_hana_preconfigure_packages_and_services['numad']['svc_state'] }}"
__sap_hana_preconfigure_packages_and_services_systemd_enabled: "{{ __sap_hana_preconfigure_packages_and_services['numad']['systemd_enabled'] }}"
__sap_hana_preconfigure_packages_and_services_systemd_state: "{{ __sap_hana_preconfigure_packages_and_services['numad']['systemd_state'] }}"

when: not sap_hana_preconfigure_use_tuned or
sap_hana_preconfigure_assert_all_config|d(false)
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

- name: Assert that the hard limit of core file creation is 0 for all users
ansible.builtin.assert:
that: "__sap_hana_preconfigure_register_limits_sap_conf_core_hard_assert.stdout == '0'"
that: __sap_hana_preconfigure_register_limits_sap_conf_core_hard_assert.stdout == '0'
fail_msg: "FAIL: The hard limit of core file creation for all users in /etc/security/limits.d/99-sap.conf is
'{{ __sap_hana_preconfigure_register_limits_sap_conf_core_hard_assert.stdout }}' but the expected value is 0!"
success_msg: "PASS: The hard limit of core file creation for all users in /etc/security/limits.d/99-sap.conf is
Expand All @@ -46,7 +46,7 @@

- name: Assert that the soft limit of core file creation is 0 for all users
ansible.builtin.assert:
that: "__sap_hana_preconfigure_register_limits_sap_conf_core_soft_assert.stdout == '0'"
that: __sap_hana_preconfigure_register_limits_sap_conf_core_soft_assert.stdout == '0'
fail_msg: "FAIL: The soft limit of core file creation for all users in /etc/security/limits.d/99-sap.conf is
'{{ __sap_hana_preconfigure_register_limits_sap_conf_core_soft_assert.stdout }}' but the expected value is 0!"
success_msg: "PASS: The soft limit of core file creation for all users in /etc/security/limits.d/99-sap.conf is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,11 @@
- name: Assert that service firewalld is disabled, and inactive or stopped
ansible.builtin.include_tasks: assert-services.yml
vars:
line_item: firewalld
__sap_hana_preconfigure_service_status: "{{ ansible_facts.services['firewalld.service'].status }}"
__sap_hana_preconfigure_service_state: "{{ ansible_facts.services['firewalld.service'].state }}"
__sap_hana_preconfigure_packages_and_services_pkg: "{{ __sap_hana_preconfigure_packages_and_services['firewalld']['pkg'] }}"
__sap_hana_preconfigure_packages_and_services_svc: "{{ __sap_hana_preconfigure_packages_and_services['firewalld']['svc'] }}"
__sap_hana_preconfigure_packages_and_services_svc_status: "{{ __sap_hana_preconfigure_packages_and_services['firewalld']['svc_status'] }}"
__sap_hana_preconfigure_packages_and_services_svc_state: "{{ __sap_hana_preconfigure_packages_and_services['firewalld']['svc_state'] }}"
__sap_hana_preconfigure_packages_and_services_systemd_enabled: "{{ __sap_hana_preconfigure_packages_and_services['firewalld']['systemd_enabled'] }}"
__sap_hana_preconfigure_packages_and_services_systemd_state: "{{ __sap_hana_preconfigure_packages_and_services['firewalld']['systemd_state'] }}"
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,11 @@
- name: Assert that service kdump is disabled, and inactive or stopped
ansible.builtin.include_tasks: assert-services.yml
vars:
line_item: kdump
__sap_hana_preconfigure_service_status: "{{ ansible_facts.services['kdump.service'].status }}"
__sap_hana_preconfigure_service_state: "{{ ansible_facts.services['kdump.service'].state }}"
__sap_hana_preconfigure_packages_and_services_pkg: "{{ __sap_hana_preconfigure_packages_and_services['kdump']['pkg'] }}"
__sap_hana_preconfigure_packages_and_services_svc: "{{ __sap_hana_preconfigure_packages_and_services['kdump']['svc'] }}"
__sap_hana_preconfigure_packages_and_services_svc_status: "{{ __sap_hana_preconfigure_packages_and_services['kdump']['svc_status'] }}"
__sap_hana_preconfigure_packages_and_services_svc_state: "{{ __sap_hana_preconfigure_packages_and_services['kdump']['svc_state'] }}"
__sap_hana_preconfigure_packages_and_services_systemd_enabled: "{{ __sap_hana_preconfigure_packages_and_services['kdump']['systemd_enabled'] }}"
__sap_hana_preconfigure_packages_and_services_systemd_state: "{{ __sap_hana_preconfigure_packages_and_services['kdump']['systemd_state'] }}"
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

- name: Assert that the mode of file /etc/init.d/boot.local is 0755
ansible.builtin.assert:
that: "__sap_hana_preconfigure_register_stat_boot_local_ksm_assert.stat.mode == '0755'"
that: __sap_hana_preconfigure_register_stat_boot_local_ksm_assert.stat.mode == '0755'
fail_msg: "FAIL: File /etc/init.d/boot.local has mode '{{ __sap_hana_preconfigure_register_stat_boot_local_ksm_assert.stat.mode }}'
but the expected mode is '0755'!"
success_msg: "PASS: File /etc/init.d/boot.local has mode 0755."
Expand Down Expand Up @@ -52,7 +52,7 @@

- name: Assert that ksm is currently disabled
ansible.builtin.assert:
that: "__sap_hana_preconfigure_register_ksm_active_assert.stdout == '0'"
that: __sap_hana_preconfigure_register_ksm_active_assert.stdout == '0'
fail_msg: "FAIL: KSM is currently enabled but it needs to be disabled!"
success_msg: "PASS: KSM is disabled currently."
ignore_errors: "{{ sap_hana_preconfigure_assert_ignore_errors | d(false) }}"
Loading

0 comments on commit e0dedd4

Please sign in to comment.