ansible/run-command-sudo.yaml
2025-03-16 23:40:30 -06:00

17 lines
392 B
YAML

---
- name: Run command on servers with sudo
hosts: all
gather_facts: false
become: true
vars_prompt:
- name: command
prompt: Enter a command to run with sudo
private: false
tasks:
- name: Run command
shell: "{{ command }}"
ignore_errors: true
register: results
- name: Print results
debug:
msg: "{{ results.stdout_lines }}"