-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup_containers.yml
90 lines (72 loc) · 1.67 KB
/
setup_containers.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Playbook used to setup containers.
---
# Common Network Setup
- hosts: localhost
pre_tasks:
- name: Remove Stale Containers
ansible.builtin.include_tasks: teardown.yml
loop: "{{ machines + vulnerables.machines }}"
loop_control:
loop_var: pc_info
- name: Base Tasks
hosts: localhost
roles:
- base
- name: DHCP Servers Tasks
hosts: dhcp_servers
roles:
- dhcp
- name: Internal Network PCs Tasks
hosts: pcs
roles:
- internal_pcs
- name: Internal Network Tasks
hosts: internal
roles:
- internal
- name: DNS Servers Tasks
hosts: dns_servers
vars:
selected_machines: "{{ machines + vulnerables.machines }}"
roles:
- dns
- name: Router Tasks
hosts: routers
roles:
- routers
# Scenario-specific Tasks
- name: Vulnerable Machine Launch
hosts: localhost
roles:
- custom_machines
- name: DMZ Network Tasks
hosts: dmz
roles:
- dmz
- name: Reverse Proxy Tasks
hosts: reverse_proxies
serial: 1
vars:
selected_machines: "{{ machines + vulnerables.machines }}"
machine_vars: "{{ (vulnerables.machines | selectattr('name', '==', inventory_hostname))[0]['vars'] }}"
roles:
- reverse_proxies
- name: Firewall Tasks
hosts: firewalls
vars:
dns_server_ip: "{{ ((machines | selectattr('name', '==', 'dns_server'))[0]['networks'] | selectattr('name', '==', 'dmz_net') | map(attribute='ipv4_address')) | first }}"
roles:
- firewalls
- name: Entrypoint Tasks
hosts: all
roles:
- entrypoint
- name: Entrypoint Tasks
hosts: localhost
roles:
- entrypoint
# ------------------ Mesh ------------------ #
- name: Mesh Network Tasks
hosts: mesh
roles:
- mesh