Playbook to run a remote script

This commit is contained in:
2023-11-20 20:16:16 +05:30
parent 56cb3a8690
commit c3c31afaaf

17
run-remote-script.yml Normal file
View File

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