4646 suser_id : " {{ suser_id }}"
4747 suser_password : " {{ suser_password }}"
4848 softwarecenter_search_query : " {{ item }}"
49- dest : " /tmp/"
49+ dest : " /tmp/"
5050 loop : " {{ softwarecenter_search_list }}"
5151 loop_control :
5252 label : " {{ item }} : {{ download_task.msg }}"
@@ -68,84 +68,6 @@ ansible-galaxy collection install community.sap_launchpad
6868ansible-playbook --timeout 60 ./community.sap_launchpad/playbooks/sample-download-install-media.yml --inventory "localhost," --connection=local
6969```
7070
71- ## Execution example with Ansible Playbook calling Ansible Role
72-
73- ** Ansible Playbook YAML, execute Ansible Role on target/remote host**
74- ``` yaml
75- ---
76- - hosts : all
77-
78- collections :
79- - community.sap_launchpad
80-
81- pre_tasks :
82- - name : Install Python package manager pip3 to system Python
83- ansible.builtin.package :
84- name : python3-pip
85- state : present
86- - name : Install Python dependencies for Ansible Modules to system Python
87- ansible.builtin.pip :
88- name :
89- - urllib3
90- - requests
91- - beautifulsoup4
92- - lxml
93-
94- # Prompt for Ansible Variables
95- vars_prompt :
96- - name : suser_id
97- prompt : Please enter S-User
98- private : no
99- - name : suser_password
100- prompt : Please enter Password
101- private : yes
102-
103- # Define Ansible Variables
104- vars :
105- ansible_python_interpreter : python3
106- softwarecenter_search_list :
107- - ' SAPCAR_1324-80000936.EXE'
108- - ' HCMT_057_0-80003261.SAR'
109-
110- # Option 1: Use roles declaration
111- roles :
112- - { role: community.sap_launchpad.software_center_download }
113-
114- # Option 2: Use sequential parse/execution, by using include_role inside Task block
115- tasks :
116- - name : Execute Ansible Role to download SAP software
117- include_role :
118- name : { role: community.sap_launchpad.software_center_download }
119- vars :
120- suser_id : " {{ suser_id }}"
121- suser_password : " {{ suser_password }}"
122- softwarecenter_search_query : " {{ item }}"
123- loop : " {{ softwarecenter_search_list }}"
124- loop_control :
125- label : " {{ item }} : {{ download_task.msg }}"
126- register : download_task
127- retries : 1
128- until : download_task is not failed
129-
130-
131- # Option 3: Use task block with import_roles
132- tasks :
133- - name : Execute Ansible Role to download SAP software
134- import_roles :
135- name : { role: community.sap_launchpad.software_center_download }
136- vars :
137- suser_id : " {{ suser_id }}"
138- suser_password : " {{ suser_password }}"
139- softwarecenter_search_query : " {{ item }}"
140- loop : " {{ softwarecenter_search_list }}"
141- loop_control :
142- label : " {{ item }} : {{ download_task.msg }}"
143- register : download_task
144- retries : 1
145- until : download_task is not failed
146-
147- ```
148-
14971** Execution of Ansible Playbook, with in-line Ansible Inventory of target/remote hosts**
15072
15173``` shell
@@ -192,17 +114,19 @@ python3
192114
193115** Execute Python Functions**
194116``` python
117+ >> > from module_utils.sap_id_sso import sap_sso_login
195118>> > from module_utils.sap_launchpad_software_center_download_runner import *
196119>> >
197120>> > # Debug
198121>> > # from module_utils.sap_api_common import debug_https
199122>> > # debug_https()
200123>> >
201- >> > # # Perform API requests to SAP Support
124+ >> > # # Perform API login requests to SAP Support
202125>> > username= ' S0000000'
203126>> > password= ' password'
204127>> > sap_sso_login(username, password)
205- >> > query_result = search_software_filename(" HCMT_057_0-80003261.SAR" )
128+ >> > # # Perform API activity requests to SAP Support (e.g. software search without deduplication, and download software)
129+ >> > query_result = search_software_filename(" HCMT_057_0-80003261.SAR" ,' ' )
206130>> > download_software(* query_result, output_dir = ' /tmp' )
207131...
208132>> > # # API responses from SAP Support
0 commit comments