Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit fcb0b2ba authored by Freezed's avatar Freezed
Browse files

:adhesive_bandage: Forbid shutdown for production host

parent fece291c
No related branches found
No related tags found
No related merge requests found
...@@ -17,7 +17,7 @@ Suitable for server and workstation. ...@@ -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 | | [`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 | | [`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 | | [`system_cfg`](tasks/system_cfg/main.yml) | Configure `root` users , NTP & `{{ my_users }}` shell |
| [`user_cfg`](tasks/user_cfg/main.yml) | Configure `{{ my_user }}` | | [`user_cfg`](tasks/user_cfg/main.yml) | Configure `{{ my_user }}` |
| [`whoami.yml`](tasks/whoami.yml) | Return message with `ansible_user` & `become_user` (`sudo` method) | | [`whoami.yml`](tasks/whoami.yml) | Return message with `ansible_user` & `become_user` (`sudo` method) |
......
...@@ -3,6 +3,12 @@ ...@@ -3,6 +3,12 @@
remote_user: root remote_user: root
tasks: tasks:
- name: Shutdown the host in 10 min - name: SHUTDOWN | in 5 min
when: inventory_hostname not in groups.production
community.general.shutdown: 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"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment