-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from sap-linuxlab/swpm
Swpm
- Loading branch information
Showing
17 changed files
with
512 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
- name: Use SWPM role | ||
hosts: app | ||
any_errors_fatal: true | ||
remote_user: my_ansible_user | ||
become: true | ||
vars: | ||
sapcar_exe: '/media/sapcar' | ||
sapinst_sar: '/media/SWPM20SP14_2-80003424.SAR' | ||
install_mode: 'guided' | ||
guided_product_id: 'NW_ABAP_OneHost:S4HANA2022.CORE.HDB.ABAP' | ||
guided_s4_sid: 'S41' | ||
guided_master_password: 'DontUseThisPassw0rd' | ||
guided_ascs_instance_number: '00' | ||
guided_ci_instance_number: '01' | ||
guided_hana_hostname: 'hanasrv01' | ||
guided_hana_sid: 'HN1' | ||
guided_hana_instance: '00' | ||
guided_hana_systemdb_system_password: 'DontUseThisPassw0rd' | ||
guided_sapexe_sar_path: '/media/SAPEXE_100-70006642.SAR' | ||
guided_igs_sar_path: '/media/igsexe_2-70005417.sar' | ||
guided_igs_helper_sar_path: '/media/igshelper_17-10010245.sar' | ||
guided_sapexedb_sar_path: '/media/SAPEXEDB_100-70006641.SAR' | ||
guided_media_path: '/media' | ||
guided_hana_admin_user_password: 'DontUseThisPassw0rd' | ||
|
||
roles: | ||
- { role: swpm_single } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# swpm_single | ||
|
||
The SWPM role will eventually offer two ways of provisioning SAP software, | ||
Guided and passthrough. Guided mode allows users to provide variables to ansible | ||
in order to install a relatively small number of SAP products in a 'standalone' | ||
scenario (no high availability). | ||
|
||
The passthrough mode will allow users to provide their own configuration files | ||
in the correct SWPM format and will allow for the installation of any SAP | ||
software product that is supported by SWPM. | ||
|
||
Currently, only the guided mode is supported and this currently only supports | ||
S4 2022. | ||
|
||
It is strongly recommended that users acquire SAP software using SAP's | ||
Maintenance Planner tool. This tool will collate all of the required software | ||
for a full S4 installation and add it to the user's software basket so that it | ||
can be downloaded using SAP Download Manager. The process of using Maintenance | ||
Planner and Download Manager is out of scope for this document. | ||
|
||
## Variables | ||
|
||
### Required variables | ||
|
||
* install_mode - string - defines the install mode. Supported values, 'guided'. | ||
* sapcar_exe - string - the location of the sapcar executable. | ||
* sapinst_sar - string - the location of the SWPM sar archive. | ||
|
||
### Guided variables | ||
|
||
The following variables are required when `install_mode` is set to `guided`. | ||
|
||
* guided_product - the product ID of the install. Currently supported product | ||
IDs are: | ||
* NW_ABAP_OneHost:S4HANA2022.CORE.HDB.ABAP | ||
|
||
### NW_ABAP_OneHost:S4HANA2022.CORE.HDB.ABAP variables | ||
|
||
When using the guided install of NW_ABAP_OneHost:S4HANA2022.CORE.HDB.ABAP, the | ||
following variables must be set: | ||
|
||
* guided_s4_sid - string - The SID of the S4 system to install | ||
* guided_master_password - string - The master password to use for the s4 | ||
install | ||
* guided_ascs_instance_number - string - the ASCS instance number, must be a two | ||
digit number, for example '00' | ||
* guided_ci_instance_number - string - the PAS instance number, must be a two | ||
digit number and must not be the same as the ASCS instance. | ||
* guided_hana_hostname - string - the hostname of the HANA server which must | ||
already be installed. | ||
* guided_hana_sid - string - The SID of the target HANA instance system. | ||
* guided_hana_instance - string - The two digit instance number of the target | ||
HANA system. | ||
* guided_hana_systemdb_system_password - string - The SystemDB password of the | ||
target HANA system. | ||
* guided_hana_admin_user_password - string - The password of the HANA user | ||
on the HANA server/cluster (\<sid\>adm). | ||
* guided_sapexe_sar_path - string - The full path of the sapcar exe. | ||
* guided_igs_sar_path - string - The full path of the IGS archive. | ||
* guided_igs_helper_sar_path - The full path of the IGS Helper archive. | ||
* guided_sapexedb_sar_path - The full path of the SAPEXEDB archive. | ||
* guided_media_path - The full path of the directory containing the S4 database | ||
archive. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Guided defaults for onehost S4 | ||
guided_network_domain: "{{ ansible_facts['domain'] }}" | ||
guided_ascs_virtual_hostname: "{{ ansible_facts['hostname'] }}" | ||
guided_ci_virtual_hostname: "{{ ansible_facts['hostname'] }}" | ||
guided_scs_virtual_hostname: "{{ ansible_facts['hostname'] }}" | ||
guided_hana_tenant_sid: "{{ guided_hana_sid }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
- name: Run Pre-Checks | ||
ansible.builtin.include_tasks: | ||
./pre-checks.yml | ||
|
||
- name: Run Tasks | ||
ansible.builtin.include_tasks: | ||
./tasks.yml | ||
|
||
- name: Run Post-Checks | ||
ansible.builtin.include_tasks: | ||
./post-checks.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
--- | ||
- name: Assert that there is only one host in the play | ||
ansible.builtin.assert: | ||
that: "{{ ansible_play_hosts | length }} == 1" | ||
fail_msg: >- | ||
When running a guided install of a OneHost solution, only one play hosts | ||
is expected. Ensure that only one host is selected in the play when | ||
running this role. | ||
success_msg: >- | ||
The correct number of hosts are in the play (one). | ||
- name: Ensure that required variables are defined for NW_ABAP_OneHost:S4HANA2022.CORE.HDB.ABAP | ||
ansible.builtin.assert: | ||
that: "{{ item }} is defined" | ||
fail_msg: >- | ||
The variable '{{ item }}' is requred when running a guided install of | ||
NW_ABAP_OneHost:S4HANA2022.CORE.HDB.ABAP but it is not currently defined. | ||
Ensure that this variable is defined before re-running the role. | ||
success_msg: >- | ||
The variable '{{ item }}' is defined. | ||
loop: "{{ int_var_guided_s4hana2022_onehost_required_variables }}" | ||
when: | ||
- install_mode == 'guided' | ||
- guided_product_id == 'NW_ABAP_OneHost:S4HANA2022.CORE.HDB.ABAP' | ||
|
||
### Check the content of the variables | ||
|
||
- name: Ensure provided SIDs are compliant | ||
ansible.builtin.assert: | ||
that: | ||
"{{ item }} is ansible.builtin.regex('^[A-Z]{1}[A-Z0-9]{2}$')" | ||
fail_msg: >- | ||
The variable '{{ item }}' must consist of three characters. Characters | ||
must be uppercase alphabetical characters or numbers only. The first | ||
character may only be an alphabetical character. The current pattern | ||
is not compliant. | ||
success_msg: >- | ||
'{{ item }}' matches the required pattern. | ||
loop: | ||
- guided_s4_sid | ||
- guided_hana_sid | ||
- guided_hana_tenant_sid | ||
|
||
- name: Ensure provided SIDs are not restricted | ||
ansible.builtin.assert: | ||
that: | ||
"{{ item }} not in int_var_reserved_sids" | ||
fail_msg: >- | ||
The variable '{{ item }}' is currently set to a reserved value that may | ||
not be used. Change this to an allowed SID before re-running the role | ||
success_msg: >- | ||
'{{ item }}' is not a restricted SID. | ||
loop: | ||
- guided_s4_sid | ||
- guided_hana_sid | ||
- guided_hana_tenant_sid | ||
|
||
- name: Check instance numbers are compliant | ||
ansible.builtin.assert: | ||
that: | ||
- "{{ item }} is ansible.builtin.regex('^[0-9]{2}$')" | ||
- "{{ item }} != '99'" | ||
fail_msg: >- | ||
The variable '{{ item }}' must be a string consisting of two numbers. | ||
All combination apart from '99' are allowed. The current pattern | ||
is not compliant. | ||
success_msg: >- | ||
'{{ item }}' matches the required pattern. | ||
loop: | ||
- guided_ascs_instance_number | ||
- guided_ci_instance_number | ||
- guided_hana_instance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
--- | ||
- name: Assert the required variables exists | ||
ansible.builtin.assert: | ||
that: "{{ item }} is defined" | ||
fail_msg: >- | ||
The variable {{ item }} must be defined. Ensure the variable is defined | ||
before re-running the role. | ||
success_msg: >- | ||
The variable {{ item }} is defined | ||
loop: "{{ int_var_required_variables }}" | ||
|
||
- name: Check install mode is supported | ||
ansible.builtin.assert: | ||
that: "'{{ install_mode }}' in int_var_install_mode_support" | ||
fail_msg: >- | ||
The variable 'install_mode' is set to {{ install_mode }}. This is not a | ||
supported value. Check the documentation and set the variable correctly | ||
before re-running the role | ||
success_msg: >- | ||
The variable 'install_mode' is set to a supported value | ||
({{ install_mode }}). | ||
- name: Assert sapcar_exe is a full path | ||
ansible.builtin.assert: | ||
that: "'{{ sapcar_exe }}' is ansible.builtin.regex('^/')" | ||
fail_msg: >- | ||
The variable sapcar_exe must be a full path to the sapcar binary. The | ||
value supplied is not a full path (it doesn't being with '/'). Ensure | ||
a full path is supplied before re-running this role. | ||
success_msg: >- | ||
The variable sapcar_exe is a full path | ||
- name: Get that sapcar binary stat data | ||
ansible.builtin.stat: | ||
path: ${sapcar_exe} | ||
|
||
- name: Check HANA host for HANA SystemDB port | ||
ansible.builtin.wait_for: | ||
host: "{{ guided_hana_hostname }}" | ||
port: "3{{ guided_hana_instance }}13" | ||
state: 'started' | ||
timeout: 5 | ||
register: int_reg_hana_port | ||
changed_when: false | ||
ignore_errors: true | ||
|
||
- name: Assert that HANA port is open | ||
ansible.builtin.assert: | ||
that: not int_reg_hana_port.failed | ||
fail_msg: >- | ||
The SystemDB port '3{{ guided_hana_instance }}13' on the given hana host | ||
'{{ guided_hana_hostname }}' does not appear to be up. Ensure that the | ||
provided details are correct and that HANA instance is up. Ensure that | ||
any firewalls between the hosts are permitting the required ports. | ||
success_msg: >- | ||
The SystemDB HANA port '3{{ guided_hana_instance }}13' on | ||
'{{ guided_hana_hostname }}' could be reached. | ||
# Checks for guided mode | ||
|
||
- name: Assert that required guided mode variables are defined | ||
ansible.builtin.assert: | ||
that: "{{ item }} is defined" | ||
fail_msg: >- | ||
The variable '{{ item }}'' not defined. This variable is required when | ||
'install_mode' is set to 'guided'. Ensure this variable is correctly set | ||
before re-running the role. | ||
success_msg: >- | ||
The required variable '{{ item }} is defined' | ||
loop: "{{ int_var_guided_required_variables }}" | ||
when: install_mode == 'guided' | ||
|
||
- name: Assert guided product is supported | ||
ansible.builtin.assert: | ||
that: "'{{ guided_product_id }}' in int_var_guided_product_support" | ||
fail_msg: >- | ||
The product ID specified in the variable '{{ guided_product_id }}' is not | ||
supported. Check the role documentation for a list of supported product | ||
IDs. | ||
success_msg: >- | ||
The supplied product_id ({{ guided_product_id }}) is supported by the | ||
role. | ||
when: install_mode == 'guided' | ||
|
||
- name: Run NW_ABAP_OneHost:S4HANA2022.CORE.HDB.ABAP Pre-Checks | ||
ansible.builtin.import_tasks: pre-checks-onehost-s4hana2022.yml | ||
when: | ||
- install_mode == 'guided' | ||
- guided_product_id == 'NW_ABAP_OneHost:S4HANA2022.CORE.HDB.ABAP' |
Oops, something went wrong.