Files
ansible/playbooks/run-remote-script.yml

18 lines
370 B
YAML

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