Skip to content

Commit

Permalink
fix: incorrect example for role exec
Browse files Browse the repository at this point in the history
  • Loading branch information
sean-freeman committed Mar 18, 2024
1 parent e895b3e commit fe49e80
Showing 1 changed file with 1 addition and 79 deletions.
80 changes: 1 addition & 79 deletions docs/EXEC_EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
suser_id: "{{ suser_id }}"
suser_password: "{{ suser_password }}"
softwarecenter_search_query: "{{ item }}"
dest: "/tmp/"
dest: "/tmp/"
loop: "{{ softwarecenter_search_list }}"
loop_control:
label: "{{ item }} : {{ download_task.msg }}"
Expand All @@ -68,84 +68,6 @@ ansible-galaxy collection install community.sap_launchpad
ansible-playbook --timeout 60 ./community.sap_launchpad/playbooks/sample-download-install-media.yml --inventory "localhost," --connection=local
```

## Execution example with Ansible Playbook calling Ansible Role

**Ansible Playbook YAML, execute Ansible Role on target/remote host**
```yaml
---
- hosts: all

collections:
- community.sap_launchpad

pre_tasks:
- name: Install Python package manager pip3 to system Python
ansible.builtin.package:
name: python3-pip
state: present
- name: Install Python dependencies for Ansible Modules to system Python
ansible.builtin.pip:
name:
- urllib3
- requests
- beautifulsoup4
- lxml

# Prompt for Ansible Variables
vars_prompt:
- name: suser_id
prompt: Please enter S-User
private: no
- name: suser_password
prompt: Please enter Password
private: yes

# Define Ansible Variables
vars:
ansible_python_interpreter: python3
softwarecenter_search_list:
- 'SAPCAR_1324-80000936.EXE'
- 'HCMT_057_0-80003261.SAR'

# Option 1: Use roles declaration
roles:
- { role: community.sap_launchpad.software_center_download }

# Option 2: Use sequential parse/execution, by using include_role inside Task block
tasks:
- name: Execute Ansible Role to download SAP software
include_role:
name: { role: community.sap_launchpad.software_center_download }
vars:
suser_id: "{{ suser_id }}"
suser_password: "{{ suser_password }}"
softwarecenter_search_query: "{{ item }}"
loop: "{{ softwarecenter_search_list }}"
loop_control:
label: "{{ item }} : {{ download_task.msg }}"
register: download_task
retries: 1
until: download_task is not failed


# Option 3: Use task block with import_roles
tasks:
- name: Execute Ansible Role to download SAP software
import_roles:
name: { role: community.sap_launchpad.software_center_download }
vars:
suser_id: "{{ suser_id }}"
suser_password: "{{ suser_password }}"
softwarecenter_search_query: "{{ item }}"
loop: "{{ softwarecenter_search_list }}"
loop_control:
label: "{{ item }} : {{ download_task.msg }}"
register: download_task
retries: 1
until: download_task is not failed

```

**Execution of Ansible Playbook, with in-line Ansible Inventory of target/remote hosts**

```shell
Expand Down

0 comments on commit fe49e80

Please sign in to comment.