summaryrefslogtreecommitdiff
path: root/ansible.yaml
diff options
context:
space:
mode:
authorAleksa Vuckovic <aleksa@vuckovic.cc>2023-10-16 19:09:29 +0200
committerAleksa Vuckovic <aleksa@vuckovic.cc>2023-10-16 23:30:53 +0200
commitca4ad65bcb032ded36610054c59182599d39360f (patch)
tree12ca4e281094984b59e3a2df7d2ce244b84e5f40 /ansible.yaml
Initial commit
Diffstat (limited to 'ansible.yaml')
-rw-r--r--ansible.yaml108
1 files changed, 108 insertions, 0 deletions
diff --git a/ansible.yaml b/ansible.yaml
new file mode 100644
index 0000000..209337e
--- /dev/null
+++ b/ansible.yaml
@@ -0,0 +1,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