From ce2e51bf06c4925bed3ad0c0a801b563af30145c Mon Sep 17 00:00:00 2001 From: heimoshuiyu Date: Thu, 29 Aug 2024 15:26:24 +0800 Subject: [PATCH] add shutdown.yaml --- shutdown.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 shutdown.yaml diff --git a/shutdown.yaml b/shutdown.yaml new file mode 100644 index 0000000..093f69e --- /dev/null +++ b/shutdown.yaml @@ -0,0 +1,9 @@ +- 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 # 忽略错误以防止连接中断后任务失败 \ No newline at end of file