Skip to content

Commit 08f9a03

Browse files
committed
fix: adjusted documentation after review
1 parent cc9e7ce commit 08f9a03

7 files changed

+160
-9
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ Enhancements to Modules and introduction of new Ansible Role.
1414

1515
Minor Changes
1616
-------------
17+
- sap_software_download: New Ansible Role with enhanced logic for downloading software using Ansible Module software_center_download (https://github.com/sap-linuxlab/community.sap_launchpad/pull/32)
1718
- software_center_download: Add option to search for latest packages (https://github.com/sap-linuxlab/community.sap_launchpad/pull/28)
1819
- maintenance_planner modules: Add option to use Display ID instead of name (https://github.com/sap-linuxlab/community.sap_launchpad/pull/31)
19-
- sap_software_download: New role for downloading software (https://github.com/sap-linuxlab/community.sap_launchpad/pull/32)
2020
- Collection Readme update and preparation for 1.2.0 release (https://github.com/sap-linuxlab/community.sap_launchpad/pull/34)
2121

2222
Bugfixes

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## Description
66

7-
This Ansible Collection executes download of SAP Software.
7+
This Ansible Collection provides roles and modules to automate interaction with SAP Launchpad API, primarily focusing on downloading software and files from the SAP Software Download Center and Maintenance Planner.
88

99
Included role and modules cover range of options:
1010
- Preparation of environment before download.

docs/DEVELOPER_NOTES.md

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
# Developer notes for community.sap_launchpad Ansible Collection
2+
3+
This document contains details for maintaining Ansible Collection.
4+
5+
## Dependencies for all modules
6+
Modules require the following Python modules to be installed on the target node (the machine where SAP software will be downloaded):
7+
8+
- wheel
9+
- urllib3
10+
- requests
11+
- beautifulsoup4
12+
- lxml
13+
14+
### Installation of dependencies using role `sap_software_download`
15+
Ansible Role `sap_software_download` installs all required dependencies as part of `02_prepare_python_environment.yml` task file.
16+
17+
### Installation of dependencies with Python Virtual Environment (venv)
18+
It is recommended to install dependencies in venv that can be removed after execution is completed.
19+
```yaml
20+
- name: Example play to install prerequisites with Python Virtual Environment
21+
hosts: all
22+
tasks:
23+
- name: Create temporary directory for Python Virtual Environment
24+
ansible.builtin.tempfile:
25+
state: directory
26+
suffix: __sap_software_download_venv
27+
register: __sap_software_download_venv
28+
29+
- name: Install Python and Python package manager pip
30+
ansible.builtin.package:
31+
name:
32+
- python311
33+
- python311-pip
34+
state: present
35+
36+
- name: Install Python modules to Python Virtual Environment
37+
ansible.builtin.pip:
38+
name:
39+
- wheel
40+
- urllib3
41+
- requests
42+
- beautifulsoup4
43+
- lxml
44+
virtualenv: "{{ __sap_software_download_venv.path }}"
45+
virtualenv_command: "python3.11 -m venv"
46+
47+
- name: Remove temporary Python Virtual Environment
48+
ansible.builtin.file:
49+
path: "{{ __sap_software_download_venv.path }}"
50+
state: absent
51+
```
52+
53+
### Installation of dependencies with Python system default
54+
```yaml
55+
- name: Example play to install prerequisites with Python system default
56+
hosts: all
57+
tasks:
58+
- name: Install Python and Python package manager pip
59+
ansible.builtin.package:
60+
name:
61+
- python31
62+
- python311-pip
63+
state: present
64+
65+
- name: Install Python modules to Python system default
66+
ansible.builtin.pip:
67+
name:
68+
- wheel
69+
- urllib3
70+
- requests
71+
- beautifulsoup4
72+
- lxml
73+
```
74+
75+
## Additional execution methods
76+
### Execution of Ansible Playbook, with in-line Ansible Inventory set as localhost
77+
78+
```shell
79+
# Install from local source directory for Ansible 2.11+
80+
ansible-galaxy collection install community.sap_launchpad
81+
82+
# Workaround install from local source directory for Ansible 2.9.x
83+
# mv ./community.sap_launchpad ~/.ansible/collections/ansible_collections/community
84+
85+
# Run Ansible Collection on localhost
86+
ansible-playbook --timeout 60 ./community.sap_launchpad/playbooks/sample-download-install-media.yml --inventory "localhost," --connection=local
87+
```
88+
89+
### Execution of Ansible Playbook, with in-line Ansible Inventory of target/remote hosts
90+
91+
```shell
92+
# Install from local source directory for Ansible 2.11+
93+
ansible-galaxy collection install ./community.sap_launchpad
94+
95+
# Workaround install from local source directory for Ansible 2.9.x
96+
# mv ./community.sap_launchpad ~/.ansible/collections/ansible_collections/community
97+
98+
# SSH Connection details
99+
bastion_private_key_file="$PWD/bastion_rsa"
100+
bastion_host="169.0.40.4"
101+
bastion_port="50222"
102+
bastion_user="bastionuser"
103+
104+
target_private_key_file="$PWD/vs_rsa"
105+
target_host="10.0.50.5"
106+
target_user="root"
107+
108+
# Run Ansible Collection to target/remote hosts via Proxy/Bastion
109+
ansible-playbook --timeout 60 ./sample-playbook.yml \
110+
--connection 'ssh' --user "$target_user" --inventory "$target_host," --private-key "$target_private_key_file" \
111+
--ssh-extra-args="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ProxyCommand='ssh -W %h:%p $bastion_user@$bastion_host -p $bastion_port -i $bastion_private_key_file -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'"
112+
```
113+
114+
## Execution of Python Modules directly
115+
### Setup local Python environment
116+
```shell
117+
# Change directory to Python scripts source
118+
cd ./plugins
119+
120+
# Create isolated Python (protect system Python)
121+
pyenv install 3.9.6
122+
pyenv virtualenv 3.9.6 sap_launchpad
123+
pyenv activate sap_launchpad
124+
125+
# Install Python Modules to current Python environment
126+
pip3 install beautifulsoup4 lxml requests
127+
128+
# Run Python, import Python Modules and run Python Functions
129+
python3
130+
```
131+
132+
### Execute Python Functions
133+
```python
134+
>>> from module_utils.sap_id_sso import sap_sso_login
135+
>>> from module_utils.sap_launchpad_software_center_download_runner import *
136+
>>>
137+
>>> # Debug
138+
>>> # from module_utils.sap_api_common import debug_https
139+
>>> # debug_https()
140+
>>>
141+
>>> ## Perform API login requests to SAP Support
142+
>>> username='S0000000'
143+
>>> password='password'
144+
>>> sap_sso_login(username, password)
145+
>>> ## Perform API activity requests to SAP Support (e.g. software search without deduplication, and download software)
146+
>>> query_result = search_software_filename("HCMT_057_0-80003261.SAR",'')
147+
>>> download_software(*query_result, output_dir='/tmp')
148+
...
149+
>>> ## API responses from SAP Support
150+
>>> exit()
151+
```

docs/module_maintenance_planner_files.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Prerequisite preparation using Python 3.11 Virtual Environment `/tmp/python_venv
6969
---
7070
- name: Example play to install prerequisites for sap_launchpad
7171
hosts: all
72-
pre_tasks:
72+
tasks:
7373
- name: Install Python and Python package manager pip
7474
ansible.builtin.package:
7575
name:
@@ -94,7 +94,7 @@ Prerequisite preparation using Python 3.11 system default</br>
9494
---
9595
- name: Example play to install prerequisites for sap_launchpad
9696
hosts: all
97-
pre_tasks:
97+
tasks:
9898
- name: Install Python and Python package manager pip
9999
ansible.builtin.package:
100100
name:

docs/module_maintenance_planner_stack_xml_download.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Prerequisite preparation using Python 3.11 Virtual Environment `/tmp/python_venv
6060
---
6161
- name: Example play to install prerequisites for sap_launchpad
6262
hosts: all
63-
pre_tasks:
63+
tasks:
6464
- name: Install Python and Python package manager pip
6565
ansible.builtin.package:
6666
name:
@@ -85,7 +85,7 @@ Prerequisite preparation using Python 3.11 system default</br>
8585
---
8686
- name: Example play to install prerequisites for sap_launchpad
8787
hosts: all
88-
pre_tasks:
88+
tasks:
8989
- name: Install Python and Python package manager pip
9090
ansible.builtin.package:
9191
name:

docs/module_software_center_download.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Prerequisite preparation using Python 3.11 Virtual Environment `/tmp/python_venv
9898
---
9999
- name: Example play to install prerequisites for sap_launchpad
100100
hosts: all
101-
pre_tasks:
101+
tasks:
102102
- name: Install Python and Python package manager pip
103103
ansible.builtin.package:
104104
name:
@@ -123,7 +123,7 @@ Prerequisite preparation using Python 3.11 system default</br>
123123
---
124124
- name: Example play to install prerequisites for sap_launchpad
125125
hosts: all
126-
pre_tasks:
126+
tasks:
127127
- name: Install Python and Python package manager pip
128128
ansible.builtin.package:
129129
name:

galaxy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ authors:
2222

2323
### OPTIONAL but strongly recommended
2424
# A short summary description of the collection
25-
description: Collection of Ansible Modules and Roles for downloading SAP Software
25+
description: Collection for automation of SAP Launchpad API, such as SAP Software downloads
2626

2727
# Either a single license or a list of licenses for content inside of a collection. Ansible Galaxy currently only
2828
# accepts L(SPDX,https://spdx.org/licenses/) licenses. This key is mutually exclusive with 'license_file'

0 commit comments

Comments
 (0)