Skip to content

Commit 9e2e1f4

Browse files
authored
Merge pull request #9 from sean-freeman/main
feat: change role name and structure
2 parents 7b54970 + dd94606 commit 9e2e1f4

File tree

15 files changed

+160
-213
lines changed

15 files changed

+160
-213
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ This Ansible Collection executes various SAP Systems operational tasks, includin
1616
- **SAP administration tasks**
1717
- Start/Stop of SAP HANA and SAP NetWeaver (in any configuration)
1818
- Update SAP profile files
19+
- Execute SAP RFCs
1920

2021
## Contents
2122

@@ -38,6 +39,7 @@ Within this Ansible Collection, there are various Ansible Roles and Ansible Modu
3839
| [sap_fapolicy](/roles/sap_fapolicy) | update service `fapolicyd` for generic / sap nw / sap hana related uids |
3940
| [sap_firewall](/roles/sap_firewall) | update service `firewalld` for generic / sap nw / sap hana related ports |
4041
| [sap_profile_update](/roles/sap_profile_update) | update default and instance profiles |
42+
| [sap_rfc](/roles/sap_rfc) | executes SAP RFCs |
4143
| [sap_rhsm](/roles/sap_rhsm) | Red Hat subscription manager registration |
4244

4345
#### Ansible Modules

galaxy.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
---
2+
13
### REQUIRED
24
# The namespace of the collection. This can be a company/brand/organization or product namespace under which all
35
# content lives. May only contain alphanumeric lowercase characters and underscores. Namespaces cannot start with
@@ -40,19 +42,20 @@ tags: []
4042
# collection label 'namespace.name'. The value is a version range
4143
# L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version
4244
# range specifiers can be set and are separated by ','
43-
dependencies: {}
45+
dependencies:
46+
community.sap_libs: '*'
4447

4548
# The URL of the originating SCM repository
46-
repository: http://example.com/repository
49+
repository: https://github.com/sap-linuxlab/community.sap_operations
4750

4851
# The URL to any online docs
49-
documentation: http://docs.example.com
52+
documentation: https://github.com/sap-linuxlab/sap-linuxlab.github.io/blob/master/README.md
5053

5154
# The URL to the homepage of the collection/project
52-
homepage: http://example.com
55+
homepage: https://sap-linuxlab.github.io
5356

5457
# The URL to the collection issue tracker
55-
issues: http://example.com/issue/tracker
58+
issues: https://github.com/sap-linuxlab/community.sap_operations/issues
5659

5760
# A list of file glob-like patterns used to filter any files or directories that should not be included in the build
5861
# artifact. A pattern is matched from the relative path of the file or directory of the collection directory. This

playbooks/sample-sap-pyrfc.yml renamed to playbooks/sample-sap-rfc.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
vars:
66
suser_id: 'S00000000'
77
suser_password: 'password'
8-
sap_nwrfc_sdk: nwrfc750P_8-70002752.zip
8+
sap_nwrfc_sdk: nwrfc750P_10-70002752.zip
99
reuse_connection:
1010
ashost: s4hana.poc.cloud
1111
sysid: TDT
@@ -29,7 +29,7 @@
2929
REQUTEXT: 'Hello SAP!'
3030
target_connection: "{{ reuse_connection }}"
3131
include_role:
32-
name: community.sap_operations.sap_pyrfc
32+
name: community.sap_operations.sap_rfc
3333
register: sap_rfc_output1
3434

3535
- name: DEBUG - Output of STFC_CONNECTION
@@ -47,7 +47,7 @@
4747
- COLUMN0: test
4848
target_connection: "{{ reuse_connection }}"
4949
include_role:
50-
name: community.sap_operations.sap_pyrfc
50+
name: community.sap_operations.sap_rfc
5151
register: sap_rfc_output2
5252

5353
- name: DEBUG - Output of STFC_STRUCTURE

plugins/module_utils/pyrfc_handler.py

Lines changed: 0 additions & 18 deletions
This file was deleted.

plugins/modules/sap_pyrfc.py

Lines changed: 0 additions & 94 deletions
This file was deleted.

roles/sap_pyrfc/README.md

Lines changed: 0 additions & 74 deletions
This file was deleted.

roles/sap_rfc/README.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# sap_rfc Ansible Role
2+
3+
The sap_rfc Ansible Role executes an SAP Remote Function Call (RFC), and performs setup as necessary ([`PyRFC`](https://github.com/SAP/PyRFC) open source by SAP, and [`SAP NWRFC SDK`](https://support.sap.com/en/product/connectors/nwrfcsdk.html)).
4+
5+
## Ansible Role Overview
6+
7+
The sap_rfc Ansible Role uses:
8+
- the Ansible Module `sap_pyrfc` from the Ansible Collection `sap_libs`, which leverages the open-source [`PyRFC`](https://github.com/SAP/PyRFC) bindings for the proprietary [`SAP NWRFC SDK`](https://support.sap.com/en/product/connectors/nwrfcsdk.html).
9+
- the Ansible Module `software_center_download` from the Ansible Collection `sap_launchpad`, which on first-run is used to download the [`SAP NWRFC SDK`](https://support.sap.com/en/product/connectors/nwrfcsdk.html).
10+
11+
Appropriate target SAP System user authorizations are required for the execute of the RFCs, and on first-run to obtain the [`SAP NWRFC SDK`](https://support.sap.com/en/product/connectors/nwrfcsdk.html) an SAP User ID with download privileges is required.
12+
13+
The Ansible Role does not contain any system-altering RFCs by default when executed.
14+
15+
The Ansible Task variables define the RFC actions to be executed. Examples are given below.
16+
17+
## Ansible Role Requirements and Dependencies
18+
19+
### Dependencies on other Ansible Roles
20+
21+
To execute successfully, this Ansible Role is dependant on the Ansible Collections:
22+
- `community.sap_launchpad` on first run
23+
- `community.sap_libs` for every run
24+
25+
The first run will setup Python altinstall, subsequent runs on the same host will re-use the Python altinstall where PyRFC enabled. This is to protect the System default Python installation from additional or altered versions of Python Packages.
26+
27+
### Operating System
28+
29+
This role has been tested on target systems using RHEL 8.x, and is designed for Linux operating systems.
30+
31+
This role has not been tested and amended for SAP NetWeaver Application Server instantiations on IBM AIX or Windows Server.
32+
33+
Assumptions for executing this role include:
34+
35+
- The target host has access to the SAP System (i.e. the SAP NetWeaver Application Server instance)
36+
- Registered OS License and OS Package repositories are available (from the relevant content delivery network of the OS vendor)
37+
38+
## Examples
39+
40+
A sample [Ansible Playbook for using the sap_rfc Ansible Role](../../playbooks/sample-sap-rfc.yml) is provided, which provides:
41+
42+
- Ansible Vars for SAP User ID with download privileges for first-run
43+
- Ansible Vars for SAP System connection details and user authorization
44+
45+
The Ansible Role is designed to provide for all different RFCs. Therefore, the RFC parameters _(IMPORTING, EXPORTING, CHANGING)_ can accept the following data types:
46+
47+
- Data elements (string, integer etc.)
48+
- ABAP Structure
49+
- ABAP Table
50+
51+
These RFC parameter data elements are mapped to the equivilant Python data type (e.g. string, integer, dictionary, list). Examples of these are shown below.
52+
53+
### Examples of Ansible Task variables for different RFC parameters
54+
55+
**RFC parameter requires a data element:**
56+
57+
- Commonly string or integer
58+
- For this input type the PyRFC Python module requires a Python string or integer
59+
- Ansible Task must declare the parameter name and use a YAML variable
60+
61+
`Ansible Task code example for data element:`
62+
```yaml
63+
target_parameters:
64+
VAR: 'ECHO'
65+
```
66+
67+
**RFC parameter requires an ABAP Structure:**
68+
69+
- For this input type the PyRFC Python module requires a Python Dictionary.
70+
- Ansible Task must declare the parameter name and use a YAML dictionary (key:value)
71+
72+
`Ansible Task code example for ABAP Struture:`
73+
```yaml
74+
target_parameters:
75+
IMPORTSTRUCT:
76+
RFCFLOAT: 1.1
77+
RFCCHAR1: 'A'
78+
```
79+
80+
**RFC requires an ABAP Table:**
81+
82+
- For this input type the PyRFC Python module requires a Python List.
83+
- The Ansible Task must declare the parameter name and use a YAML list
84+
85+
`Ansible Task code example for ABAP Table:`
86+
```yaml
87+
target_parameters:
88+
RFCTABLE:
89+
- COLUMN0: SAP
90+
- COLUMN1: 1.23
91+
```
92+
93+
## Supplementary information
94+
95+
The [Supplementary information](./SUPPLEMENTARY.md) provides:
96+
- Context of SAP NWRFC SDK and PyRFC
97+
- Explanation of samples from SAP NWRFC SDK
98+
- Brief explanation of SAP RFCs
99+
- Security concerns with RFCs and SAP Systems

roles/sap_pyrfc/SUPPLEMENTARY.md renamed to roles/sap_rfc/SUPPLEMENTARY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Supplementary information for sap_pyrfc Ansible Role
1+
# Supplementary information for sap_rfc Ansible Role
22

33
## Brief explanation of SAP RFCs
44

@@ -44,7 +44,7 @@ Other connectors/bindings to have previously existed but are infrequently used w
4444

4545
This additional context is to avoid confusion. By default the SAP NetWeaver RFC SDK includes two sample ALE programs (rfcexec or startrfc) as reference implementations which support the SAP IDoc scenario.
4646

47-
Neither of these sample programs are used by sap_pyrfc Ansible Role or the underlying PyRFC bindings.
47+
Neither of these sample programs are used by sap_rfc Ansible Role or the underlying sap_pyrfc Ansible Module and the PyRFC bindings.
4848

4949
These sample ALE programs appear in documentation available on help.sap.com under the IDoc Interface/ALE section:
5050
- Using startrfc, [SAP NetWeaver AS - IDoc Interface/ALE - Inbound: Triggering the SAP System](https://help.sap.com/viewer/8f3819b0c24149b5959ab31070b64058/7.52.3/en-US/4b4c43dd3b71265ce10000000a421937.html)

0 commit comments

Comments
 (0)