blob: 209337e441533b48d4055376cb071ed056e163e2 (
plain)
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
- name: fast
hosts: 127.0.0.1
become: yes
tasks:
- name: Install Python Virtualenv
apt:
name: python3-virtualenv
state: present
- name: Install docker-compose
apt:
name: docker-compose
state: present
- name: Pull PostgreSQL Docker Image
docker_image:
name: postgres:alpine
source: pull
- name: Run PostgreSQL Container
docker_container:
name: fastdb
image: postgres:alpine
env:
POSTGRES_DB: fast
POSTGRES_USER: admin
POSTGRES_PASSWORD: admin
ports:
- "5432:5432"
detach: yes
- name: Create ~/fast directory
file:
path: ~/fast
state: directory
become: yes
- name: Copy server.yaml and submitter.py to fast directory
copy:
src: "./fast/server.yaml"
dest: ~/fast/server.yaml
become: yes
- name: Copy file2 to ~/fast
copy:
src: "./fast/submitter.py"
dest: ~/fast/submitter.py
become: yes
- name: Install fast package in the virtual environment
pip:
name: https://github.com/dusanlazic/fast/releases/download/v1.1.0-czechia/fast-1.1.0-czechia.tar.gz
virtualenv: ~/fast-venv
- name: tulip
hosts: 127.0.0.1
become: yes
tasks:
- name: Clone tulip repository from GitHub
git:
repo: https://github.com/OpenAttackDefenseTools/tulip
dest: ~/tulip
force: yes
- name: Copy tulip.env to .env
copy:
src: "./tulip/tulip.env"
dest: ~/tulip/.env
- name: Apply the Docker Compose patch
patch:
src: "./tulip/0001-restart-always.patch"
dest: ~/tulip/docker-compose.yml
- name: Build and run Docker containers with Docker Compose
docker_compose:
project_src: ~/tulip
become: yes
- name: nginx
hosts: 127.0.0.1
become: yes
tasks:
- name: Install Nginx
apt:
name: nginx
state: present
- name: Configure Nginx for fast.ctf.rs and tulip.ctf.rs
template:
src: "./nginx/ctf.rs.conf"
dest: /etc/nginx/sites-available/ctf.rs.conf
notify: Reload Nginx
- name: Enable Nginx sites
file:
src: /etc/nginx/sites-available/ctf.rs.conf
dest: /etc/nginx/sites-enabled/ctf.rs.conf
state: link
notify: Reload Nginx
handlers:
- name: Reload Nginx
service:
name: nginx
state: reloaded
|