Skip to content

Commit f7efa6c

Browse files
committed
Add protected environment checks hook
1 parent e4deac6 commit f7efa6c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

environments/site/hooks/pre.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
3+
- hosts: localhost
4+
gather_facts: no
5+
become: no
6+
tasks:
7+
- name: Confirm continuing if using production environment
8+
ansible.builtin.pause:
9+
prompt: |
10+
*************************************
11+
* WARNING: PROTECTED ENVIRONMENT! *
12+
*************************************
13+
14+
Current environment: {{ appliances_environment_name }}
15+
Do you really want to continue (yes/no)?
16+
register: env_confirm_safe
17+
when:
18+
- appliances_environment_name in protected_environments
19+
- not (prd_continue | default(false) | bool)
20+
failed_when: not (env_confirm_safe.user_input | bool)

0 commit comments

Comments
 (0)