--- - hosts: all become: true vars_prompt: - name: script prompt: "Enter the script to be run" private: no - name: argument prompt: "Enter the argument" private: no tasks: - name: Fetch script ansible.builtin.uri: url: "{{ script }}" return_content: yes register: sc - name: Run script ansible.builtin.shell: cmd: "{{ argument }}" stdin: "{{ sc.content }}"