Skip to content

Commit

Permalink
v1.2.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis CI User committed Aug 25, 2022
1 parent 70f05df commit 8fecfd1
Show file tree
Hide file tree
Showing 143 changed files with 1,797 additions and 437 deletions.
305 changes: 267 additions & 38 deletions README.md

Large diffs are not rendered by default.

151 changes: 113 additions & 38 deletions cli/README.md

Large diffs are not rendered by default.

26 changes: 19 additions & 7 deletions cli/ansible/roles/s4appinst/tasks/install_kit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,32 @@
when: "'rsync' in ansible_facts.packages"
delegate_to: localhost

- name: Gather the package facts for target
- name: Gather the package facts for Red Hat target
package_facts:
manager: auto
when: ansible_facts['os_family'] == "RedHat"

- name: Check if rsync package is available on target
- name: Gather the packages for Suse target # noqa 305
shell: zypper search -i --match-exact rsync
args:
warn: false
register: rsync_search_result
when: ansible_facts['os_family'] == "Suse"

- name: Check if rsync package is available
set_fact:
rsync_found_target: true
when: "'rsync' in ansible_facts.packages"
when: ansible_facts['os_family'] == "RedHat" and "'rsync' in ansible_facts.packages" or ansible_facts['os_family'] == "Suse" and rsync_search_result.rc == 0

- name: Copy S4/HANA kit to target using rsync
- name: Copy S/4HANA kit to target using rsync
synchronize:
src: "{{ item.s4apps_src }}"
dest: "{{ item.s4apps_dest }}"
checksum: yes
loop: "{{ s4apps_kit }}"
when: rsync_found_controller is defined and rsync_found_target is defined

- name: Copy S4/HANA kit to target when rsync is not available
- name: Copy S/4HANA kit to target when rsync is not available
copy:
src: "{{ item.s4apps_src }}"
dest: "{{ item.s4apps_dest }}"
Expand All @@ -55,9 +63,13 @@
recurse: yes
owner: root
group: root
when: rsync_found_controller is defined and rsync_found_target is defined

- name: Check if SWPM archive content was already extracted
stat:
path: "{{ s4app_kit }}/swpm/sapinst"
register: file_status

- name: Extract SWPM archive
command: "{{ s4app_kit }}/sapcar -xf {{ s4app_kit }}/swpm.sar -R {{ s4app_kit }}/swpm"

when: not file_status.stat.exists
...
12 changes: 10 additions & 2 deletions cli/ansible/roles/s4appinst/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@
src: sapinst.cfg
dest: "{{ s4app_kit }}/inifile.params"

- name: Start SAP S4HANA Application Server installation
shell: "{{ s4app_kit }}/swpm/sapinst SAPINST_INPUT_PARAMETERS_URL={{ s4app_kit }}/inifile.params SAPINST_EXECUTE_PRODUCT_ID={{ sap_product_id }} SAPINST_SKIP_DIALOGS=true SAPINST_START_GUISERVER=false"
- name: Check if S/4HANA Application Server was already installed
stat:
path: "/sapmnt/{{ sap_sid|upper }}/exe/uc/linuxx86_64/SAPCAR"
register: install_status

- name: Start SAP S/4HANA Application Server installation # noqa 305
shell: >-
{{ s4app_kit }}/swpm/sapinst SAPINST_INPUT_PARAMETERS_URL={{ s4app_kit }}/inifile.params
SAPINST_EXECUTE_PRODUCT_ID={{ sap_product_id }} SAPINST_SKIP_DIALOGS=true SAPINST_START_GUISERVER=false
when: not install_status.stat.exists

- name: Cleanup
file:
Expand Down
63 changes: 62 additions & 1 deletion cli/ansible/roles/s4appreq/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,70 @@ sap_disk_size: "128.00 GB"
swap_disk_size: "40.00 GB"

#Logical volume size config
swap_lv_size: "30g"
# swap_lv_size: "30g"
usrsap_lv_size: "5g"
sap_lv_size: "20g"
sapmnt_lv_size: "20g"
saptrans_lv_size: "50g"

# SWAP size GB
# SAP note 1597355
# Commented until terraform code update
# swap_lv:
# - size: 64
# ram_min: 32
# ram_max: 63
# - size: 96
# ram_min: 64
# ram_max: 127
# - size: 128
# ram_min: 128
# ram_max: 255
# - size: 160
# ram_min: 256
# ram_max: 511
# - size: 192
# ram_min: 512
# ram_max: 1023
# - size: 224
# ram_min: 1024
# ram_max: 2047
# - size: 256
# ram_min: 2048
# ram_max: 4095
# - size: 288
# ram_min: 4096
# ram_max: 8191
# - size: 320
# ram_min: 8192
# ram_max: 20000

swap_lv:
- size: 38
ram_min: 32
ram_max: 63
- size: 38
ram_min: 64
ram_max: 127
- size: 38
ram_min: 128
ram_max: 255
- size: 38
ram_min: 256
ram_max: 511
- size: 38
ram_min: 512
ram_max: 1023
- size: 224
ram_min: 1024
ram_max: 2047
- size: 38
ram_min: 2048
ram_max: 4095
- size: 288
ram_min: 4096
ram_max: 8191
- size: 38
ram_min: 8192
ram_max: 20000
...
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
- name: Disable SELinux
selinux:
state: disabled
...
...
11 changes: 11 additions & 0 deletions cli/ansible/roles/s4appreq/tasks/configurations/abrtd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
- name: Get the list of services
service_facts:

- name: Stop and disable abrtd
systemd:
name: abrtd
state: stopped
enabled: no
when: "'abrtd.service' in services"
...
26 changes: 23 additions & 3 deletions cli/ansible/roles/s4appreq/tasks/configurations/filesystems.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
- name: Get available storage devices for swap
set_fact:
set_fact:
swap_disk: "{{ swap_disk|default([]) + [device.key] }}"
when:
- not device.value.partitions
Expand All @@ -23,7 +23,7 @@
pesize: "32"

- name: Get available storage devices for SAP instance
set_fact:
set_fact:
sap_disk: "{{ sap_disk|default([]) + [device.key] }}"
when:
- not device.value.partitions
Expand All @@ -45,6 +45,21 @@
pvs: "/dev/{{ sap_disk[0] }}"
pesize: "32"

- name: Get the RAM size
set_fact:
app_ram: "{{ app_profile.split('-')[1].split('x')[1] }}"

- name: Get the swap logical volume size for RAM lower than 32 GB
set_fact:
swap_lv_size: "{{ app_ram | int * 2 }}g"
when: app_ram | int < 32

- name: Get the swap logical volume size for RAM higher than 32 GB
set_fact:
swap_lv_size: "{{ item.size }}g"
loop: "{{ swap_lv }}"
when: (app_ram | int > 32) and (app_ram | int >= item.ram_min) and (app_ram | int <= item.ram_min)

- name: Create a logical volume for swap
lvol:
vg: "{{ sap_sid|lower }}_swap_vg"
Expand Down Expand Up @@ -73,7 +88,7 @@
lvol:
vg: "{{ sap_sid|lower }}_app_vg"
lv: "{{ sap_sid|lower }}_saptrans_lv"
size: "{{ saptrans_lv_size }}"
size: "{{ saptrans_lv_size }}"

- name: Create a swap filesystem
filesystem:
Expand Down Expand Up @@ -106,8 +121,13 @@
regexp: "^/dev/{{ sap_sid|lower }}_swap_vg/{{ sap_sid|lower }}_swap_lv"
line: "/dev/{{ sap_sid|lower }}_swap_vg/{{ sap_sid|lower }}_swap_lv swap swap defaults 0 0"

- name: Check the current swap size
set_fact:
sap_vm_swap: "{{ ansible_swaptotal_mb }}"

- name: Mount swap volume
command: swapon -a
when: sap_vm_swap == 0

- name: Mount /usr/sap and add it to /etc/fstab
mount:
Expand Down
28 changes: 15 additions & 13 deletions cli/ansible/roles/s4appreq/tasks/configurations/hostname.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,29 @@
- name: Get short hostname
command: hostname -s
register: sap_short_hostname
changed_when: False

- name: Get FQDN
set_fact:
sap_host_fqdn: "{{ ansible_fqdn }}"

- name: Check if hostname has 13 or less characters as per SAP requirement
fail:
msg: "Hostname {{ sap_short_hostname.stdout }} has more than 13 characters"
when: sap_short_hostname.stdout|length > 13

- name: Disable manage_etc_hosts in /etc/cloud/cloud.cfg
replace:
path: /etc/cloud/cloud.cfg
regexp: '(.*manage_etc_hosts.*)'
replace: '#\1'
- name: Line to be added in /etc/hosts if FQDN is set
set_fact:
line_to_add: "{{ ansible_default_ipv4.address }} {{ sap_host_fqdn }} {{ sap_short_hostname.stdout }}"
when: sap_short_hostname.stdout != sap_host_fqdn

#1054467 - Local host name refers to loopback address
- name: Disable default hostname resolve to loopback address
replace:
path: /etc/hosts
regexp: "(.*{{ ansible_hostname }}.*)"
replace: '#\1'
- name: Line to be added in /etc/hosts if FQDN is not set
set_fact:
line_to_add: "{{ ansible_default_ipv4.address }} {{ sap_short_hostname.stdout }}"
when: sap_short_hostname.stdout == sap_host_fqdn

- name: Enable hostname resolve to internal IP
- name: Enable hostname resolve to internal IP
lineinfile:
path: /etc/hosts
line: "{{ ansible_default_ipv4.address }} {{ ansible_hostname }}"
line: "{{ line_to_add }}"
...
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
- name: Disable manage_etc_hosts in /etc/cloud/cloud.cfg
replace:
path: /etc/cloud/cloud.cfg
regexp: '(.*manage_etc_hosts.*)'
replace: '#\1'

- name: Get short hostname
command: hostname -s
register: sap_short_hostname
changed_when: False

#1054467 - Local host name refers to loopback address
- name: Disable default hostname resolve to loopback address
replace:
path: /etc/hosts
regexp: "^(?!{{ ansible_default_ipv4.address }}.*{{ sap_short_hostname.stdout }})(.*)({{ sap_short_hostname.stdout }}.*)"
replace: '\1'
...
11 changes: 11 additions & 0 deletions cli/ansible/roles/s4appreq/tasks/configurations/kdump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
- name: Get the list of services
service_facts:

- name: Stop and disable kdump
systemd:
name: kdump
state: stopped
enabled: no
when: "'kdump.service' in services"
...
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
- { name: kernel.sem, value: "1250 256000 100 1024" }
- { name: vm.max_map_count, value: 2147483647 } #900929 - Linux: STORAGE_PARAMETERS_WRONG_SET and "mmap() failed"
loop_control:
loop_var: kernel_param
loop_var: kernel_param
...
16 changes: 16 additions & 0 deletions cli/ansible/roles/s4appreq/tasks/configurations/kernel_RedHat8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
- name: Set recommended kernel parameters for SAP NW on RedHat 8
sysctl:
sysctl_file: /etc/sysctl.d/sap.conf
name: "{{ kernel_param.name }}"
value: "{{ kernel_param.value }}"
sysctl_set: yes
state: present
reload: yes
loop:
- { name: vm.max_map_count, value: 2147483647 }
- { name: kernel.pid_max, value: 4194304 }
- { name: kernel.sem, value: "32000 1024000000 500 32000" }
loop_control:
loop_var: kernel_param
...
2 changes: 1 addition & 1 deletion cli/ansible/roles/s4appreq/tasks/configurations/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
loop_control:
loop_var: ltype

- name: Set core limits
- name: Set core limits
lineinfile:
path: /etc/security/limits.conf
line: "{{ corelimit }}"
Expand Down
6 changes: 6 additions & 0 deletions cli/ansible/roles/s4appreq/tasks/configurations/reboot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- name: Reboot target host
reboot:
connect_timeout: 5
post_reboot_delay: 10
...
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
- name: Wait for cloud init to finish
cloud_init_data_facts:
filter: status
register: res
until: "res.cloud_init_data_facts.status.v1.stage is defined and not res.cloud_init_data_facts.status.v1.stage"
retries: 60
delay: 10
...
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- name: Wait for SLES repo configurations
wait_for:
path: /etc/SUSEConnect
...
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
- name: Import requierd package groups
dnf:
state: present
name: "{{ s4app_required_package_groups }}"
name: "{{ s4app_required_package_groups }}"
...
17 changes: 17 additions & 0 deletions cli/ansible/roles/s4appreq/tasks/configurations/saptune.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
- name: Start and enable saptune service
service:
name: saptune
state: started
enabled: yes

- name: Check if NETWEAVER profile was already set
command: saptune status
register: netweaver_profile
changed_when: False
failed_when: netweaver_profile.rc != 0 and netweaver_profile.rc != 3

- name: Select NETWEAVER profile for saptune
command: /usr/sbin/saptune solution apply NETWEAVER
when: "'NETWEAVER' not in netweaver_profile.stdout"
...
12 changes: 12 additions & 0 deletions cli/ansible/roles/s4appreq/tasks/configurations/umask_RHEL.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- name: Configure default umask
replace:
path: "{{ file }}"
regexp: '(.*umask 077.*)'
replace: 'umask 022'
loop:
- /etc/profile
- /etc/bashrc
loop_control:
loop_var: file
...
Loading

0 comments on commit 8fecfd1

Please sign in to comment.