generated from Skatteetaten/vagrant-hashistack-template
-
Notifications
You must be signed in to change notification settings - Fork 5
/
00_create_intention.yml
58 lines (51 loc) · 2.91 KB
/
00_create_intention.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
- name: set variable
set_fact:
consul_token: "{{ lookup('env', 'consul_master_token') }}"
#*************************************************************************************************#
# mc => minio (allow)
#*************************************************************************************************#
- name: Check if intention mc => minio (allow) exists
shell: consul intention match -source mc
register: mc_intention
when: lookup('env', 'consul_acl') | bool and lookup('env', 'consul_acl_default_policy') == 'deny'
environment:
CONSUL_HTTP_TOKEN: "{{ consul_token }}"
- name: Consul create intention mc => minio (allow)
shell: consul intention create mc minio
when: lookup('env', 'consul_acl') | bool and lookup('env', 'consul_acl_default_policy') == 'deny' and mc_intention.stdout_lines == []
environment:
CONSUL_HTTP_TOKEN: "{{ consul_token }}"
#*************************************************************************************************#
# hive-metastore => postgres (allow),
# hive-metastore => minio (allow)
#*************************************************************************************************#
- name: Check if intentions from hive-metastore exist
shell: consul intention match -source hive-metastore
register: hive_metastore_intention
when: lookup('env', 'consul_acl') | bool and lookup('env', 'consul_acl_default_policy') == 'deny'
environment:
CONSUL_HTTP_TOKEN: "{{ consul_token }}"
- name: Consul create intention hive-metastore => postgres (allow)
shell: consul intention create hive-metastore postgres
when: lookup('env', 'consul_acl') | bool and lookup('env', 'consul_acl_default_policy') == 'deny' and hive_metastore_intention.stdout_lines == []
environment:
CONSUL_HTTP_TOKEN: "{{ consul_token }}"
- name: Consul create intention hive-metastore => minio (allow)
shell: consul intention create hive-metastore minio
when: lookup('env', 'consul_acl') | bool and lookup('env', 'consul_acl_default_policy') == 'deny' and hive_metastore_intention.stdout_lines == []
environment:
CONSUL_HTTP_TOKEN: "{{ consul_token }}"
#*************************************************************************************************#
# minio-local => minio (allow)
#*************************************************************************************************#
- name: Check if intention minio-local => minio (allow) exists
shell: consul intention match -source minio-local
register: minio_local_intention
when: lookup('env', 'consul_acl') | bool and lookup('env', 'consul_acl_default_policy') == 'deny'
environment:
CONSUL_HTTP_TOKEN: "{{ consul_token }}"
- name: Consul create intention minio-local => minio (allow)
shell: consul intention create minio-local minio
when: lookup('env', 'consul_acl') | bool and lookup('env', 'consul_acl_default_policy') == 'deny' and minio_local_intention.stdout_lines == []
environment:
CONSUL_HTTP_TOKEN: "{{ consul_token }}"