Move the debug script into a role rather than in the playbook
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
This commit is contained in:
parent
0c064fa4b7
commit
ba9844b8ef
3 changed files with 18 additions and 19 deletions
|
@ -5,23 +5,6 @@
|
|||
tasks:
|
||||
- debug: var=msg
|
||||
|
||||
- name: run my own script
|
||||
hosts: localhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Install my own script
|
||||
copy:
|
||||
src: files/debug.py
|
||||
dest: /usr/local/bin/debug.py
|
||||
mode: 0755
|
||||
|
||||
- name: Run the script
|
||||
command: /usr/local/bin/debug.py '{{ msg | to_json }}'
|
||||
register: output
|
||||
environment:
|
||||
TEST_VARIABLE: \ó/
|
||||
|
||||
- name: Show the output of the script
|
||||
debug:
|
||||
msg: "Output of the script: {{ output }}"
|
||||
roles:
|
||||
- {role: debug, msg: msg}
|
||||
|
||||
|
|
16
playbooks/roles/debug/tasks/main.yml
Normal file
16
playbooks/roles/debug/tasks/main.yml
Normal file
|
@ -0,0 +1,16 @@
|
|||
- name: Install my own script
|
||||
copy:
|
||||
src: files/debug.py
|
||||
dest: /usr/local/bin/debug.py
|
||||
mode: 0755
|
||||
|
||||
- name: Run the script
|
||||
command: /usr/local/bin/debug.py '{{ msg | to_json }}'
|
||||
register: output
|
||||
environment:
|
||||
TEST_VARIABLE: \ó/
|
||||
|
||||
- name: Show the output of the script
|
||||
debug:
|
||||
msg: "Output of the script: {{ output }}"
|
||||
|
Reference in a new issue