Skip to content

Commit 78b8e15

Browse files
authored
Merge pull request #51 from marcelmamula/refactor
collection: Refactor all Ansible Modules
2 parents 3888bf0 + 9d4f770 commit 78b8e15

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+3031
-2576
lines changed

LICENSE

100755100644
File mode changed.

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,11 @@ See [Installing collections](https://docs.ansible.com/ansible/latest/collections
7373
### Ansible Modules
7474
| Name | Summary |
7575
| :-- | :-- |
76-
| [sap_launchpad.software_center_download](./docs/module_software_center_download.md) | Search and download SAP Software file |
77-
| [sap_launchpad.maintenance_planner_files](./docs/module_maintenance_planner_files.md) | Get list of files from Maintenance Planner |
78-
| [sap_launchpad.maintenance_planner_stack_xml_download](./docs/module_maintenance_planner_stack_xml_download.md) | Get stack file from Maintenance Planner |
76+
| [sap_launchpad.software_center_download](./docs/module_software_center_download.md) | Downloads software from the SAP Software Center |
77+
| [sap_launchpad.maintenance_planner_files](./docs/module_maintenance_planner_files.md) | Retrieves a list of files from an SAP Maintenance Planner transaction|
78+
| [sap_launchpad.maintenance_planner_stack_xml_download](./docs/module_maintenance_planner_stack_xml_download.md) | Downloads the stack.xml file from an SAP Maintenance Planner transaction |
79+
| [sap_launchpad.license_keys](./docs/module_license_keys.md) | Creates systems and license keys |
80+
| [sap_launchpad.systems_info](./docs/module_systems_info.md) | Retrieves information about SAP systems |
7981

8082
### Ansible Roles
8183
| Name | Summary |

docs/DEVELOPER_NOTES.md

Lines changed: 10 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ It is recommended to install dependencies in venv that can be removed after exec
5151
```
5252
5353
### Installation of dependencies with Python system default
54+
**NOTE:** Python modules are installed as packages to avoid `externally-managed-environment` error.
5455
```yaml
5556
- name: Example play to install prerequisites with Python system default
5657
hosts: all
@@ -62,14 +63,15 @@ It is recommended to install dependencies in venv that can be removed after exec
6263
- python311-pip
6364
state: present
6465
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
66+
- name: Install Python module packages
67+
ansible.builtin.package:
68+
name:
69+
- python311-wheel
70+
- python311-urllib3
71+
- python311-requests
72+
- python311-beautifulsoup4
73+
- python311-lxml
74+
state: present
7375
```
7476

7577
## Additional execution methods
@@ -110,42 +112,3 @@ ansible-playbook --timeout 60 ./sample-playbook.yml \
110112
--connection 'ssh' --user "$target_user" --inventory "$target_host," --private-key "$target_private_key_file" \
111113
--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'"
112114
```
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-
```

0 commit comments

Comments
 (0)