commit 293405a474edb331660de87c7b37588e819b80ab Author: CentOS Sources Date: Tue Jan 21 17:46:54 2020 -0500 import rhel-system-roles-sap-1.1.1-1.el8_1 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1974274 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/rhel-system-roles-sap-2019-09-30_18-11-12.tar.gz diff --git a/.rhel-system-roles-sap.metadata b/.rhel-system-roles-sap.metadata new file mode 100644 index 0000000..de9a4a4 --- /dev/null +++ b/.rhel-system-roles-sap.metadata @@ -0,0 +1 @@ +71a7dd706b059d82346b9ec876bbacc946974d70 SOURCES/rhel-system-roles-sap-2019-09-30_18-11-12.tar.gz diff --git a/SOURCES/rhel-system-roles-sap-0.7.2-rhel-7.8.patch b/SOURCES/rhel-system-roles-sap-0.7.2-rhel-7.8.patch new file mode 100644 index 0000000..ab6224d --- /dev/null +++ b/SOURCES/rhel-system-roles-sap-0.7.2-rhel-7.8.patch @@ -0,0 +1,14 @@ +diff -up rhel-system-roles-sap-0.7.2/sap-hana-preconfigure/vars/RedHat_7.yml.me rhel-system-roles-sap-0.7.2/sap-hana-preconfigure/vars/RedHat_7.yml +--- rhel-system-roles-sap-0.7.2/sap-hana-preconfigure/vars/RedHat_7.yml.me 2019-10-15 16:26:41.311466458 +0200 ++++ rhel-system-roles-sap-0.7.2/sap-hana-preconfigure/vars/RedHat_7.yml 2019-10-15 18:48:35.470383628 +0200 +@@ -71,6 +71,10 @@ sap_hana_preconfigure_min_packages_7.6: + sap_hana_preconfigure_min_packages_7.7: + - [ 'kernel' , '3.10.0-1062.1.1.el7' ] + ++## Double check with SAP NOTE 2235581 ++sap_hana_preconfigure_min_packages_7.8: ++ - [ 'kernel' , '3.10.0-1101.el7' ] ++ + sap_hana_preconfigure_min_pkgs: "{{ lookup('vars','sap_hana_preconfigure_min_packages_' + ansible_distribution_version|string ) }}" + + sap_hana_preconfigure_packages: diff --git a/SOURCES/sap-hana-preconfigure-38a18c2890aa80c4562d002cc557945bdf9c5e7e.patch b/SOURCES/sap-hana-preconfigure-38a18c2890aa80c4562d002cc557945bdf9c5e7e.patch new file mode 100644 index 0000000..96b70c7 --- /dev/null +++ b/SOURCES/sap-hana-preconfigure-38a18c2890aa80c4562d002cc557945bdf9c5e7e.patch @@ -0,0 +1,32 @@ +commit 38a18c2890aa80c4562d002cc557945bdf9c5e7e +Author: Bernd Finger +Date: Tue Oct 1 18:00:59 2019 +0200 + + added "LC_ALL=C " before commands for which the outputs are to be evaluated + +diff --git a/tasks/RedHat/generic/configure-cpu-governor-for-performance.yml b/tasks/RedHat/generic/configure-cpu-governor-for-performance.yml +index 3cef670..274c7ea 100644 +--- a/tasks/RedHat/generic/configure-cpu-governor-for-performance.yml ++++ b/tasks/RedHat/generic/configure-cpu-governor-for-performance.yml +@@ -7,7 +7,7 @@ + # in included tuned profile throughput-performance + - block: + - name: Check if system is able to set CPU Governor for performance +- command: bash -lc "cpupower frequency-info -g | awk '/available cpufreq governors/{print $(NF-1), $NF}'" ++ command: bash -lc "LC_ALL=C cpupower frequency-info -g | awk '/available cpufreq governors/{print $(NF-1), $NF}'" + check_mode: no + register: command_check_result + ignore_errors: true +diff --git a/tasks/RedHat/generic/configure-epb.yml b/tasks/RedHat/generic/configure-epb.yml +index adf5891..71d8b91 100644 +--- a/tasks/RedHat/generic/configure-epb.yml ++++ b/tasks/RedHat/generic/configure-epb.yml +@@ -7,7 +7,7 @@ + # in included tuned profile throughput-performance + - block: + - name: Check if system supports Intel's performance bias setting +- command: bash -lc "cpupower info | head -1 | awk '{print $2, $3, $4}'" ++ command: bash -lc "LC_ALL=C cpupower info | head -1 | awk '{print $2, $3, $4}'" + check_mode: no + register: command_check_result + ignore_errors: true diff --git a/SOURCES/sap-preconfig-b10e9f539263e1a2fd9222d6c52c55c7cb337130.patch b/SOURCES/sap-preconfig-b10e9f539263e1a2fd9222d6c52c55c7cb337130.patch new file mode 100644 index 0000000..a8796aa --- /dev/null +++ b/SOURCES/sap-preconfig-b10e9f539263e1a2fd9222d6c52c55c7cb337130.patch @@ -0,0 +1,115 @@ +commit b10e9f539263e1a2fd9222d6c52c55c7cb337130 +Author: Bernd Finger +Date: Wed Oct 2 22:54:14 2019 +0200 + + - convert variables to bool when comparing in when: statements + - always use ansible_hostname + ansible_domain instead of ansible_fqdn + +diff --git a/tasks/sapnote/2002167/03-setting-the-hostname.yml b/tasks/sapnote/2002167/03-setting-the-hostname.yml +index f4e57f8..21de429 100644 +--- a/tasks/sapnote/2002167/03-setting-the-hostname.yml ++++ b/tasks/sapnote/2002167/03-setting-the-hostname.yml +@@ -19,40 +19,40 @@ + failed_when: change_hostname.rc >= 2 + + - name: Check if ipv4 address, FQDN, and hostname are in /etc/hosts +- command: bash -lc "awk 'BEGIN{a=0}/{{ ansible_default_ipv4.address }}/&&/{{ ansible_fqdn }}/&&/{{ ansible_hostname }}/{a++}END{print a}' /etc/hosts" ++ command: bash -lc "awk 'BEGIN{a=0}/{{ ansible_default_ipv4.address }}/&&/{{ ansible_hostname }}.{{ ansible_domain }}/&&/{{ ansible_hostname }}/{a++}END{print a}' /etc/hosts" + register: command_result + changed_when: no + - debug: + var: command_result.stdout_lines, command_result.stderr_lines + when: +- - not sap_preconfigure_modify_etc_hosts ++ - not sap_preconfigure_modify_etc_hosts | bool + + - debug: + msg: + - "Expected:" +- - "{{ ansible_default_ipv4.address }} {{ ansible_fqdn }} {{ ansible_hostname }}" ++ - "{{ ansible_default_ipv4.address }} {{ ansible_hostname }}.{{ ansible_domain }} {{ ansible_hostname }}" + when: + - command_result.stdout != "1" +- - not sap_preconfigure_modify_etc_hosts ++ - not sap_preconfigure_modify_etc_hosts | bool + + - fail: + msg: + - "Server's ipv4 address, FQDN, or hostname are not in /etc/hosts!" + when: + - command_result.stdout != "1" +- - not sap_preconfigure_modify_etc_hosts ++ - not sap_preconfigure_modify_etc_hosts | bool + + - name: Make sure server's IP address is in /etc/hosts + lineinfile: + path: /etc/hosts + regexp: '^{{ ansible_default_ipv4.address }}' + insertbefore: '^127.0.0.1' +-# line: "{{ ansible_default_ipv4.address }} {{ ansible_fqdn }} {{ ansible_hostname }} " +- line: "{{ ansible_default_ipv4.address }} {{ ansible_hostname }}.{{ ansible_domain }} {{ ansible_hostname }} " ++# line: "{{ ansible_default_ipv4.address }} {{ ansible_fqdn }} {{ ansible_hostname }}" ++ line: "{{ ansible_default_ipv4.address }} {{ ansible_hostname }}.{{ ansible_domain }} {{ ansible_hostname }}" + state: present + when: +- - sap_preconfigure_modify_etc_hosts ++ - sap_preconfigure_modify_etc_hosts | bool + - debug: +- msg: "System {{ ansible_hostname }}, {{ ansible_fqdn }} has ipv4 address {{ ansible_default_ipv4.address }}" ++ msg: "System {{ ansible_hostname }}, {{ ansible_hostname }}.{{ ansible_domain }} has ipv4 address {{ ansible_default_ipv4.address }}" + + ... +diff --git a/tasks/sapnote/2772999/03-configure-hostname.yml b/tasks/sapnote/2772999/03-configure-hostname.yml +index f89ca68..3de61a5 100644 +--- a/tasks/sapnote/2772999/03-configure-hostname.yml ++++ b/tasks/sapnote/2772999/03-configure-hostname.yml +@@ -19,40 +19,40 @@ + failed_when: change_hostname.rc >= 2 + + - name: Check if ipv4 address, FQDN, and hostname are in /etc/hosts +- command: bash -lc "awk 'BEGIN{a=0}/{{ ansible_default_ipv4.address }}/&&/{{ ansible_fqdn }}/&&/{{ ansible_hostname }}/{a++}END{print a}' /etc/hosts" ++ command: bash -lc "awk 'BEGIN{a=0}/{{ ansible_default_ipv4.address }}/&&/{{ ansible_hostname }}.{{ ansible_domain }}/&&/{{ ansible_hostname }}/{a++}END{print a}' /etc/hosts" + register: command_result + changed_when: no + - debug: + var: command_result.stdout_lines, command_result.stderr_lines + when: +- - not sap_preconfigure_modify_etc_hosts ++ - not sap_preconfigure_modify_etc_hosts | bool + + - debug: + msg: + - "Expected:" +- - "{{ ansible_default_ipv4.address }} {{ ansible_fqdn }} {{ ansible_hostname }}" ++ - "{{ ansible_default_ipv4.address }} {{ ansible_hostname }}.{{ ansible_domain }} {{ ansible_hostname }}" + when: + - command_result.stdout != "1" +- - not sap_preconfigure_modify_etc_hosts ++ - not sap_preconfigure_modify_etc_hosts | bool + + - fail: + msg: + - "Server's ipv4 address, FQDN, or hostname are not in /etc/hosts!" + when: + - command_result.stdout != "1" +- - not sap_preconfigure_modify_etc_hosts ++ - not sap_preconfigure_modify_etc_hosts | bool + + - name: Make sure server's IP address is in /etc/hosts + lineinfile: + path: /etc/hosts + regexp: '^{{ ansible_default_ipv4.address }}' + insertbefore: '^127.0.0.1' +-# line: "{{ ansible_default_ipv4.address }} {{ ansible_fqdn }} {{ ansible_hostname }} " +- line: "{{ ansible_default_ipv4.address }} {{ ansible_hostname }}.{{ ansible_domain }} {{ ansible_hostname }} " ++# line: "{{ ansible_default_ipv4.address }} {{ ansible_fqdn }} {{ ansible_hostname }}" ++ line: "{{ ansible_default_ipv4.address }} {{ ansible_hostname }}.{{ ansible_domain }} {{ ansible_hostname }}" + state: present + when: +- - sap_preconfigure_modify_etc_hosts ++ - sap_preconfigure_modify_etc_hosts | bool + - debug: +- msg: "System {{ ansible_hostname }}, {{ ansible_fqdn }} has ipv4 address {{ ansible_default_ipv4.address }}" ++ msg: "System {{ ansible_hostname }}, {{ ansible_hostname }}.{{ ansible_domain }} has ipv4 address {{ ansible_default_ipv4.address }}" + + ... diff --git a/SOURCES/sap-preconfig-baa3b58a0d2a60bb0e222b3dac5190c8ea171cf3.patch b/SOURCES/sap-preconfig-baa3b58a0d2a60bb0e222b3dac5190c8ea171cf3.patch new file mode 100644 index 0000000..0770eac --- /dev/null +++ b/SOURCES/sap-preconfig-baa3b58a0d2a60bb0e222b3dac5190c8ea171cf3.patch @@ -0,0 +1,34 @@ +commit baa3b58a0d2a60bb0e222b3dac5190c8ea171cf3 +Author: Bernd Finger +Date: Tue Oct 1 18:40:03 2019 +0200 + + use {{ ansible_hostname }}.{{ ansible_domain }} instead of {{ ansible_fqdn }} + +diff --git a/tasks/sapnote/2002167/03-setting-the-hostname.yml b/tasks/sapnote/2002167/03-setting-the-hostname.yml +index e95fb74..f4e57f8 100644 +--- a/tasks/sapnote/2002167/03-setting-the-hostname.yml ++++ b/tasks/sapnote/2002167/03-setting-the-hostname.yml +@@ -47,7 +47,8 @@ + path: /etc/hosts + regexp: '^{{ ansible_default_ipv4.address }}' + insertbefore: '^127.0.0.1' +- line: "{{ ansible_default_ipv4.address }} {{ ansible_fqdn }} {{ ansible_hostname }} " ++# line: "{{ ansible_default_ipv4.address }} {{ ansible_fqdn }} {{ ansible_hostname }} " ++ line: "{{ ansible_default_ipv4.address }} {{ ansible_hostname }}.{{ ansible_domain }} {{ ansible_hostname }} " + state: present + when: + - sap_preconfigure_modify_etc_hosts +diff --git a/tasks/sapnote/2772999/03-configure-hostname.yml b/tasks/sapnote/2772999/03-configure-hostname.yml +index 258c9f5..f89ca68 100644 +--- a/tasks/sapnote/2772999/03-configure-hostname.yml ++++ b/tasks/sapnote/2772999/03-configure-hostname.yml +@@ -47,7 +47,8 @@ + path: /etc/hosts + regexp: '^{{ ansible_default_ipv4.address }}' + insertbefore: '^127.0.0.1' +- line: "{{ ansible_default_ipv4.address }} {{ ansible_fqdn }} {{ ansible_hostname }} " ++# line: "{{ ansible_default_ipv4.address }} {{ ansible_fqdn }} {{ ansible_hostname }} " ++ line: "{{ ansible_default_ipv4.address }} {{ ansible_hostname }}.{{ ansible_domain }} {{ ansible_hostname }} " + state: present + when: + - sap_preconfigure_modify_etc_hosts diff --git a/SPECS/rhel-system-roles-sap.spec b/SPECS/rhel-system-roles-sap.spec new file mode 100644 index 0000000..aae1b1a --- /dev/null +++ b/SPECS/rhel-system-roles-sap.spec @@ -0,0 +1,81 @@ +# avoiding version conflict, set version 1.1.1 for rhel8 +%define upstream_vesion 2019-09-30_18-11-12 + +Name: rhel-system-roles-sap +Summary: System Role prepares a RHEL system for running SAP software for SAP HANA +Version: 1.1.1 +Release: 1%{?dist} +License: GPLv3+ +Url: https://github.com/berndfinger +Source0: https://than.fedorapeople.org/rhel/%{name}-%{upstream_vesion}.tar.gz + +# set sap_hana_preconfigure_min_packages_7.8 for rhel-7.8 +Patch0: rhel-system-roles-sap-0.7.2-rhel-7.8.patch + +# use {{ ansible_hostname }}.{{ ansible_domain }} instead of {{ ansible_fqdn }} +Patch1: sap-preconfig-baa3b58a0d2a60bb0e222b3dac5190c8ea171cf3.patch + +# convert variables to bool when comparing in when: statements +# always use ansible_hostname + ansible_domain instead of ansible_fqdn +Patch2: sap-preconfig-b10e9f539263e1a2fd9222d6c52c55c7cb337130.patch + +# set LC_ALL=C +Patch3: sap-hana-preconfigure-38a18c2890aa80c4562d002cc557945bdf9c5e7e.patch + +BuildArch: noarch +Requires: uuidd + +%description +Collection of Ansible roles which configures a RHEL system according +to applicable SAP notes so that any SAP software can be installed. + +%prep +%setup -q -T -c -n %{name}-%{version} -a 0 +%patch0 -p1 +pushd sap-preconfigure +%patch1 -p1 +%patch2 -p1 +popd +pushd sap-hana-preconfigure +%patch3 -p1 +popd + +%build + +%install +mkdir -p $RPM_BUILD_ROOT%{_datadir}/ansible/roles \ + $RPM_BUILD_ROOT%{_pkgdocdir}/sap-hana-preconfigure \ + $RPM_BUILD_ROOT%{_pkgdocdir}/sap-preconfigure \ + $RPM_BUILD_ROOT%{_pkgdocdir}/sap-netweaver-preconfigure + +# drop zero file +rm -f */.gitignore sap-hana-preconfigure/tasks/RedHat_6/recommendations.yml + +cp -pR sap-hana-preconfigure sap-preconfigure sap-netweaver-preconfigure $RPM_BUILD_ROOT%{_datadir}/ansible/roles/ +cp -p sap-hana-preconfigure/{README.md,LICENSE} $RPM_BUILD_ROOT%{_pkgdocdir}/sap-hana-preconfigure/ +cp -p sap-preconfigure/{README.md,LICENSE} $RPM_BUILD_ROOT%{_pkgdocdir}/sap-preconfigure/ +cp -p sap-netweaver-preconfigure/{README.md,LICENSE} $RPM_BUILD_ROOT%{_pkgdocdir}/sap-netweaver-preconfigure/ + +%files +%dir %{_pkgdocdir} +%dir %{_pkgdocdir}/sap-preconfigure +%dir %{_pkgdocdir}/sap-hana-preconfigure +%dir %{_pkgdocdir}/sap-netweaver-preconfigure +%dir %{_datadir}/ansible +%dir %{_datadir}/ansible/roles +%doc %{_pkgdocdir}/*/README.md +%license %{_pkgdocdir}/*/LICENSE +%{_datadir}/ansible/roles/* + +%changelog +* Mon Oct 21 2019 Than Ngo - 1.1.1-1 +- rebase to 1.1.1 +- always use ansible_hostname + ansible_domain instead of ansible_fqdn +- use {{ ansible_hostname }}.{{ ansible_domain }} instead of {{ ansible_fqdn }} +- added LC_ALL=C before commands for which the outputs are to be evaluated + +* Thu Sep 12 2019 Than Ngo - 1.1-1 +- rebase to 1.1 + +* Fri Jun 28 2019 Than Ngo - 1.0-1 +- Initial release.