From ca4ad65bcb032ded36610054c59182599d39360f Mon Sep 17 00:00:00 2001 From: Aleksa Vuckovic Date: Mon, 16 Oct 2023 19:09:29 +0200 Subject: Initial commit --- ansible.yaml | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 ansible.yaml (limited to 'ansible.yaml') 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 -- cgit v1.2.3