summaryrefslogtreecommitdiff
path: root/ansible.yaml
blob: 62a2abb6e2e4c844fcfa4647f26b12a24050ec77 (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
- 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: Apply the Tulip Services patch
      patch:
        src: "./tulip/0002-tulip-services.patch"
        dest: ~/tulip/services/api/configurations.py

    - 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