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