diff --git a/README.md b/README.md index b4727582cfad8cc4d175a826ba6e364f17bc135f..35213f1da3784df4c6c4680573146405f3632770 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Suitable for server and workstation. | :--------------------------------------: | :--------------------------------------------------------------: | | [`become_user_cfg.yml`](tasks/become_user_cfg.yml) | Set `sudo` without password for `become_user` access | | [`host_info.yml`](tasks/host_info.yml) | Return message with distribution full name & version | -| [`shutdown.yml`](tasks/shutdown.yml) | Shutdown target in 10 min | +| [`shutdown.yml`](tasks/shutdown.yml) | Shutdown target in 5 min (not if host is in production group) | | [`system_cfg`](tasks/system_cfg/main.yml) | Configure `root` users , NTP & `{{ my_users }}` shell | | [`user_cfg`](tasks/user_cfg/main.yml) | Configure `{{ my_user }}` | | [`whoami.yml`](tasks/whoami.yml) | Return message with `ansible_user` & `become_user` (`sudo` method) | diff --git a/tasks/shutdown.yml b/tasks/shutdown.yml index 310be6ccdcfbb45ba1e97fffebd632b62d380f0a..f6de220bef98cb2505af027f8b3dd73e6f018c57 100644 --- a/tasks/shutdown.yml +++ b/tasks/shutdown.yml @@ -3,6 +3,12 @@ remote_user: root tasks: - - name: Shutdown the host in 10 min + - name: SHUTDOWN | in 5 min + when: inventory_hostname not in groups.production community.general.shutdown: - delay: 600 + delay: 300 + + - name: SHUTDOWN | not allowed + when: inventory_hostname in groups.production + ansible.builtin.debug: + msg: "«{{ ansible_hostname }}» belongs to production group: shutdown not allowed"