Files
ansible/shutdown.yaml
2024-08-29 15:26:24 +08:00

9 lines
306 B
YAML

- name: Shutdown remote servers
hosts: all # 或者指定特定的主机组
become: yes # 提升权限为root用户
tasks:
- name: Shutdown the server
command: /sbin/shutdown -h now
async: 1
poll: 0
ignore_errors: true # 忽略错误以防止连接中断后任务失败