From c3c31afaaf017f7fb5db3779301cf6d9965ee74e Mon Sep 17 00:00:00 2001 From: Akshun Date: Mon, 20 Nov 2023 20:16:16 +0530 Subject: [PATCH] Playbook to run a remote script --- run-remote-script.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 run-remote-script.yml diff --git a/run-remote-script.yml b/run-remote-script.yml new file mode 100644 index 0000000..ff74d57 --- /dev/null +++ b/run-remote-script.yml @@ -0,0 +1,17 @@ +--- +- hosts: all + become: true + vars_prompt: + - name: script + prompt: "Enter the script to be run" + private: no + tasks: + - name: Fetch script + ansible.builtin.uri: + url: "{{ script }}" + return_content: yes + register: sc + - name: Run script + ansible.builtin.shell: + cmd: bash -s + stdin: "{{ sc.content }}"