ansible/run-command-sudo.yaml

18 lines
392 B
YAML
Raw Permalink Normal View History

2025-03-16 23:34:04 -06:00
---
- 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 }}"