From ba9844b8ef3234684cc001408169cea02f702609 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Wed, 8 Aug 2018 14:58:16 +0200 Subject: [PATCH] Move the debug script into a role rather than in the playbook Signed-off-by: Pierre-Yves Chibon --- ...roject.stg.buildsys.build.state.change.yml | 21 ++----------------- playbooks/{ => roles/debug}/files/debug.py | 0 playbooks/roles/debug/tasks/main.yml | 16 ++++++++++++++ 3 files changed, 18 insertions(+), 19 deletions(-) rename playbooks/{ => roles/debug}/files/debug.py (100%) create mode 100644 playbooks/roles/debug/tasks/main.yml diff --git a/playbooks/org.fedoraproject.stg.buildsys.build.state.change.yml b/playbooks/org.fedoraproject.stg.buildsys.build.state.change.yml index d2e47ac..a3482c7 100644 --- a/playbooks/org.fedoraproject.stg.buildsys.build.state.change.yml +++ b/playbooks/org.fedoraproject.stg.buildsys.build.state.change.yml @@ -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} diff --git a/playbooks/files/debug.py b/playbooks/roles/debug/files/debug.py similarity index 100% rename from playbooks/files/debug.py rename to playbooks/roles/debug/files/debug.py diff --git a/playbooks/roles/debug/tasks/main.yml b/playbooks/roles/debug/tasks/main.yml new file mode 100644 index 0000000..e6bf61f --- /dev/null +++ b/playbooks/roles/debug/tasks/main.yml @@ -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 }}" +