Skip to content

Commit

Permalink
Merge pull request #558 from berndfinger/issue-555
Browse files Browse the repository at this point in the history
sap_general_preconfigure: Support Ansible 2.16.1
  • Loading branch information
berndfinger authored Jan 3, 2024
2 parents 388f7fc + 0607852 commit cd820d5
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

- name: Assert that all required repos are enabled
ansible.builtin.assert:
that: "'{{ line_item }}' in __sap_general_preconfigure_register_enabled_repos_assert.stdout_lines"
that: line_item in __sap_general_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 @@ -73,7 +73,7 @@

- 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_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 }}'."
Expand Down Expand Up @@ -107,7 +107,7 @@

- name: Assert that all required RHEL 7 package groups are installed
ansible.builtin.assert:
that: "'{{ line_item }}' in __sap_general_preconfigure_register_yum_group_assert.stdout_lines"
that: line_item in __sap_general_preconfigure_register_yum_group_assert.stdout_lines
fail_msg: "FAIL: Package group '{{ line_item }}' is not installed!"
success_msg: "PASS: Package group '{{ line_item }}' is installed."
loop: "{{ sap_general_preconfigure_packagegroups | map('replace', '@', '') | list }}"
Expand Down Expand Up @@ -136,7 +136,7 @@

- name: Assert that all required RHEL 8 environment groups are installed
ansible.builtin.assert:
that: "'{{ line_item }}' in __sap_general_preconfigure_register_yum_envgroup_assert.stdout_lines"
that: line_item in __sap_general_preconfigure_register_yum_envgroup_assert.stdout_lines
fail_msg: "FAIL: Environment group '{{ line_item }}' is not installed!"
success_msg: "PASS: Environment group '{{ line_item }}' is installed."
with_items:
Expand All @@ -147,7 +147,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 @@ -163,10 +163,11 @@
register: __sap_general_preconfigure_register_required_ppc64le_packages_assert
changed_when: no
when: ansible_architecture == "ppc64le"
ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(false) }}"

- name: Assert that all required IBM packages are installed
ansible.builtin.assert:
that: "'{{ line_item }}' in __sap_general_preconfigure_register_required_ppc64le_packages_assert.stdout_lines"
that: line_item in __sap_general_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 @@ -37,7 +37,7 @@

- name: Assert that sap_ip is set
ansible.builtin.assert:
that: "__sap_general_preconfigure_register_dig_short_assert.stdout == '{{ sap_ip }}'"
that: __sap_general_preconfigure_register_dig_short_assert.stdout == sap_ip
fail_msg: "FAIL: The variable 'sap_ip' is not set!"
success_msg: "PASS: The variable 'sap_ip' is set."
ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(false) }}"
Expand All @@ -53,7 +53,7 @@

- name: Assert that the IP address for sap_hostname is resolved correctly
ansible.builtin.assert:
that: "__sap_general_preconfigure_register_dig_search_short_assert.stdout == '{{ sap_ip }}'"
that: __sap_general_preconfigure_register_dig_search_short_assert.stdout == sap_ip
fail_msg: "FAIL: The IP address for 'sap_hostname' could not be resolved!"
success_msg: "PASS: The IP address for 'sap_hostname' was resolved."
ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(true) }}"
Expand All @@ -68,7 +68,7 @@

- name: Assert that the reverse name resolution is correct
ansible.builtin.assert:
that: "__sap_general_preconfigure_register_dig_reverse_assert.stdout == '{{ sap_hostname }}.{{ sap_domain }}.'"
that: __sap_general_preconfigure_register_dig_reverse_assert.stdout == (sap_hostname + '.' + sap_domain + '.')
fail_msg: "FAIL: The reverse name resolution of 'sap_ip' was not successful!"
success_msg: "PASS: The reverse name resolution of 'sap_ip' was successful."
ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(true) }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

- name: Assert that ipv4 address, FQDN, and hostname are once in /etc/hosts
ansible.builtin.assert:
that: "__sap_general_preconfigure_register_ipv4_fqdn_sap_hostname_once_assert.stdout == '1'"
that: __sap_general_preconfigure_register_ipv4_fqdn_sap_hostname_once_assert.stdout == '1'
fail_msg: "FAIL: The line '{{ sap_ip }} {{ sap_hostname }}.{{ sap_domain }} {{ sap_hostname }}' needs to be once in /etc/hosts!"
success_msg: "PASS: The line '{{ sap_ip }} {{ sap_hostname }}.{{ sap_domain }} {{ sap_hostname }}' is once in /etc/hosts."
ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(false) }}"
Expand All @@ -52,7 +52,7 @@

- name: Assert that there is just one line containing {{ sap_ip }} in /etc/hosts
ansible.builtin.assert:
that: "__sap_general_preconfigure_register_sap_ip_once_assert.stdout == '1'"
that: __sap_general_preconfigure_register_sap_ip_once_assert.stdout == '1'
fail_msg: "FAIL: There is no line, or more than one line, containing '{{ sap_ip }}' in /etc/hosts!"
success_msg: "PASS: There is only one line containing '{{ sap_ip }}' in /etc/hosts."
ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(false) }}"
Expand All @@ -67,7 +67,7 @@

- name: Assert that there is just one line containing {{ sap_hostname }}.{{ sap_domain }} in /etc/hosts
ansible.builtin.assert:
that: "__sap_general_preconfigure_register_fqdn_once_assert.stdout == '1'"
that: __sap_general_preconfigure_register_fqdn_once_assert.stdout == '1'
fail_msg: "FAIL: There is no line, or more than one line, containing '{{ sap_hostname }}.{{ sap_domain }}' in /etc/hosts!"
success_msg: "PASS: There is only one line containing '{{ sap_hostname }}.{{ sap_domain }}' in /etc/hosts."
ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(false) }}"
Expand All @@ -82,7 +82,7 @@

- name: Assert that there is just one line containing {{ sap_hostname }} in /etc/hosts
ansible.builtin.assert:
that: "__sap_general_preconfigure_register_sap_hostname_once_assert.stdout == '1'"
that: __sap_general_preconfigure_register_sap_hostname_once_assert.stdout == '1'
fail_msg: "FAIL: There is no line, or more than one line, containing '{{ sap_hostname }}' in /etc/hosts!"
success_msg: "PASS: There is only one line containing '{{ sap_hostname }}' in /etc/hosts."
ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(false) }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@

- name: Assert that the output of hostname matches the content of variable sap_hostname
ansible.builtin.assert:
that: "__sap_general_preconfigure_register_hostname_assert.stdout == '{{ sap_hostname }}'"
that: __sap_general_preconfigure_register_hostname_assert.stdout == sap_hostname
fail_msg: "FAIL: The output of 'hostname' does not match the content of variable 'sap_hostname'!"
success_msg: "PASS: The output of 'hostname' matches the content of variable 'sap_hostname'."
ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(false) }}"

- name: "Assert that the length of the hostname is not longer than 'sap_general_preconfigure_max_hostname_length'"
ansible.builtin.assert:
that: "{{ sap_hostname | length | int }} <= {{ sap_general_preconfigure_max_hostname_length | int }}"
that: (sap_hostname | length | int) <= (sap_general_preconfigure_max_hostname_length | int)
fail_msg: "FAIL: The length of the hostname is {{ sap_hostname | length | int }} but must be less or equal to {{ sap_general_preconfigure_max_hostname_length }} (variable 'sap_general_preconfigure_max_hostname_length')!"
success_msg: "PASS: The length of the hostname is {{ sap_hostname | length | int }}, which is less or equal to {{ sap_general_preconfigure_max_hostname_length }} (variable 'sap_general_preconfigure_max_hostname_length')."
ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(false) }}"
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

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

- name: Assert that {{ line_item.name }} is set correctly as per sysctl
ansible.builtin.assert:
that: "__sap_general_preconfigure_register_sysctl_kernel_parameter_assert.stdout == '{{ line_item.value }}'"
that: __sap_general_preconfigure_register_sysctl_kernel_parameter_assert.stdout == line_item.value
fail_msg: "FAIL: The current value of '{{ line_item.name }}' as per sysctl is
'{{ __sap_general_preconfigure_register_sysctl_kernel_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 @@ -11,7 +11,7 @@

- name: Assert that the hard limit of nofile for group sapsys is 1048576
ansible.builtin.assert:
that: "__sap_general_preconfigure_register_limits_sap_conf_nofile_hard_assert.stdout == '1048576'"
that: __sap_general_preconfigure_register_limits_sap_conf_nofile_hard_assert.stdout == '1048576'
fail_msg: "FAIL: The hard limit of nofile for group 'sapsys' in /etc/security/limits.d/99-sap.conf is
'{{ __sap_general_preconfigure_register_limits_sap_conf_nofile_hard_assert.stdout }}' but the expected value is 1048576 !"
success_msg: "PASS: The hard limit of nofile for group 'sapsys' in /etc/security/limits.d/99-sap.conf is
Expand All @@ -32,7 +32,7 @@

- name: Assert that the soft limit of nofile for group sapsys is 1048576
ansible.builtin.assert:
that: "__sap_general_preconfigure_register_limits_sap_conf_nofile_soft_assert.stdout == '1048576'"
that: __sap_general_preconfigure_register_limits_sap_conf_nofile_soft_assert.stdout == '1048576'
fail_msg: "FAIL: The soft limit of nofile for group 'sapsys' in /etc/security/limits.d/99-sap.conf is
'{{ __sap_general_preconfigure_register_limits_sap_conf_nofile_soft_assert.stdout }}' but the expected value is 1048576 !"
success_msg: "PASS: The soft limit of nofile for group 'sapsys' in /etc/security/limits.d/99-sap.conf is
Expand All @@ -54,7 +54,7 @@

- name: Assert that the hard limit of nofile for the database group is 1048576
ansible.builtin.assert:
that: "__sap_general_preconfigure_register_limits_sap_conf_db_group_nofile_hard_assert.stdout == '1048576'"
that: __sap_general_preconfigure_register_limits_sap_conf_db_group_nofile_hard_assert.stdout == '1048576'
fail_msg: "FAIL: The hard limit of nofile for group '{{ sap_general_preconfigure_db_group_name }}' is not set to '1048576' in /etc/security/limits.d/99-sap.conf!"
success_msg: "PASS: The hard limit of nofile for group '{{ sap_general_preconfigure_db_group_name }}' is set to '1048576' in /etc/security/limits.d/99-sap.conf."
ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(false) }}"
Expand All @@ -75,7 +75,7 @@

- name: Assert that the soft limit of nofile for the database group is 1048576
ansible.builtin.assert:
that: "__sap_general_preconfigure_register_limits_sap_conf_db_group_nofile_soft_assert.stdout == '1048576'"
that: __sap_general_preconfigure_register_limits_sap_conf_db_group_nofile_soft_assert.stdout == '1048576'
fail_msg: "FAIL: The soft limit of nofile for group '{{ sap_general_preconfigure_db_group_name }}' is not set to '1048576' in /etc/security/limits.d/99-sap.conf!"
success_msg: "PASS: The soft limit of nofile for group '{{ sap_general_preconfigure_db_group_name }}' is set to '1048576' in /etc/security/limits.d/99-sap.conf."
ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(false) }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

- name: Assert that the hard limit of nproc for group sapsys is unlimited
ansible.builtin.assert:
that: "__sap_general_preconfigure_register_limits_sap_conf_nproc_hard_assert.stdout == 'unlimited'"
that: __sap_general_preconfigure_register_limits_sap_conf_nproc_hard_assert.stdout == 'unlimited'
fail_msg: "FAIL: The hard limit of nproc for group 'sapsys' in /etc/security/limits.d/99-sap.conf is
'{{ __sap_general_preconfigure_register_limits_sap_conf_nproc_hard_assert.stdout }}' but the expected value is 'unlimited'!"
success_msg: "PASS: The hard limit of nproc for group 'sapsys' in /etc/security/limits.d/99-sap.conf is
Expand All @@ -32,7 +32,7 @@

- name: Assert that the soft limit of nproc for group sapsys is unlimited
ansible.builtin.assert:
that: "__sap_general_preconfigure_register_limits_sap_conf_nproc_soft_assert.stdout == 'unlimited'"
that: __sap_general_preconfigure_register_limits_sap_conf_nproc_soft_assert.stdout == 'unlimited'
fail_msg: "FAIL: The soft limit of nproc for group 'sapsys' in /etc/security/limits.d/99-sap.conf is
'{{ __sap_general_preconfigure_register_limits_sap_conf_nproc_hard_assert.stdout }}' but the expected value is 'unlimited'!"
success_msg: "PASS: The soft limit of nproc for group 'sapsys' in /etc/security/limits.d/99-sap.conf is
Expand All @@ -54,7 +54,7 @@

- name: Assert that the hard limit of nproc for the database group is unlimited
ansible.builtin.assert:
that: "__sap_general_preconfigure_register_limits_sap_conf_db_group_nproc_hard_assert.stdout == 'unlimited'"
that: __sap_general_preconfigure_register_limits_sap_conf_db_group_nproc_hard_assert.stdout == 'unlimited'
fail_msg: "FAIL: The hard limit of nproc for group '{{ sap_general_preconfigure_db_group_name }}' in /etc/security/limits.d/99-sap.conf is
'{{ __sap_general_preconfigure_register_limits_sap_conf_db_group_nproc_hard_assert.stdout }}' but the expected value is 'unlimited'!"
success_msg: "PASS: The hard limit of nproc for group '{{ sap_general_preconfigure_db_group_name }}' in /etc/security/limits.d/99-sap.conf is
Expand All @@ -77,7 +77,7 @@

- name: Assert that the soft limit of nproc for the database group is unlimited
ansible.builtin.assert:
that: "__sap_general_preconfigure_register_limits_sap_conf_db_group_nproc_soft_assert.stdout == 'unlimited'"
that: __sap_general_preconfigure_register_limits_sap_conf_db_group_nproc_soft_assert.stdout == 'unlimited'
fail_msg: "FAIL: The soft limit of nproc for group '{{ sap_general_preconfigure_db_group_name }}' in /etc/security/limits.d/99-sap.conf is
'{{ __sap_general_preconfigure_register_limits_sap_conf_db_group_nproc_soft_assert.stdout }}' but the expected value is 'unlimited'!"
success_msg: "PASS: The soft limit of nproc for group '{{ sap_general_preconfigure_db_group_name }}' in /etc/security/limits.d/99-sap.conf is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

- name: "Assert that the permanent configuration of the SELinux state is set to '{{ sap_general_preconfigure_selinux_state }}'"
ansible.builtin.assert:
that: __sap_general_preconfigure_register_selinux_conf_assert.stdout == "{{ sap_general_preconfigure_selinux_state }}"
that: __sap_general_preconfigure_register_selinux_conf_assert.stdout == sap_general_preconfigure_selinux_state
fail_msg: "FAIL: The system is not configured for the SELinux state of '{{ sap_general_preconfigure_selinux_state }}'.
Current configuration: '{{ __sap_general_preconfigure_register_selinux_conf_assert.stdout }}'."
success_msg: "PASS: The system is configured for the SELinux state of '{{ sap_general_preconfigure_selinux_state }}'"
Expand All @@ -48,7 +48,7 @@

- name: Assert that the SELinux state is set correctly
ansible.builtin.assert:
that: __sap_general_preconfigure_register_getenforce_assert.stdout | lower == "{{ sap_general_preconfigure_selinux_state }}"
that: (__sap_general_preconfigure_register_getenforce_assert.stdout | lower) == sap_general_preconfigure_selinux_state
fail_msg: "FAIL: SELinux is currently not '{{ sap_general_preconfigure_selinux_state }}'!
The current SELinux state is: '{{ __sap_general_preconfigure_register_getenforce_assert.stdout | lower }}'."
success_msg: "PASS: SELinux is currently {{ sap_general_preconfigure_selinux_state }}."
Expand Down Expand Up @@ -89,7 +89,7 @@

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

- name: Assert that all files in '/usr/sap' and below have the 'usr_t' file context
ansible.builtin.assert:
that: __sap_general_preconfigure_register_ls_z_usr_sap.stdout | int == 0
that: (__sap_general_preconfigure_register_ls_z_usr_sap.stdout | int) == 0
fail_msg: "FAIL: There is at least one file in '/usr/sap' or below without the 'usr_t' file context!"
success_msg: "PASS: All files in '/usr/sap' and below have the 'usr_t' file context."
ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(false) }}"
Expand Down
Loading

0 comments on commit cd820d5

Please sign in to comment.