Playbook to run a remote script
This commit is contained in:
17
run-remote-script.yml
Normal file
17
run-remote-script.yml
Normal 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 }}"
|
||||||
Reference in New Issue
Block a user