-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpython-script.yml
More file actions
51 lines (42 loc) · 1.18 KB
/
python-script.yml
File metadata and controls
51 lines (42 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
- name: Get and run a script
hosts: ansible-test-host-1
tasks:
- name: Ensure /srv folder exists
file:
path: /srv
state: directory
- name: Get python script
get_url:
url: https://github.com/briandesousa/containerized-ansible-with-podman/raw/main/script.py
dest: /srv
mode: '0744'
- name: Run script
shell: python3 /srv/script.py
register: pythonScriptOutput
- name: Print python script output
debug:
msg: "Python script output: {{pythonScriptOutput.stdout}}"
- name: Get package
get_url:
url: https://github.com/briandesousa/containerized-ansible-with-podman/raw/main/package.tar
dest: /srv
mode: '0744'
- name: Create folder
file:
path: /srv/package
state: directory
mode: '0744'
- name: Extract package to folder
unarchive:
src: /srv/package.tar
remote_src: yes
dest: /srv/package
mode: '0744'
list_files: true
- name: Run script from extracted package
shell: python3 /srv/package/script2.py
register: pythonScript2Output
- name: Print script2 output
debug:
msg: "Python script2 output: {{pythonScript2Output.stdout}}"