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:
Pierre-Yves Chibon 2018-08-08 14:58:16 +02:00
parent 0c064fa4b7
commit ba9844b8ef
3 changed files with 18 additions and 19 deletions

View file

@ -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}

View 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 }}"