summaryrefslogtreecommitdiff
path: root/baserock_webserver/instance-config.yml
blob: 60e7bf00200df55ec794ee1c1446bc1793145400 (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
# Instance configuration for Baserock general-purpose webserver.
#
# Tested against Fedora 26 base image.
---
- hosts: webserver
  become: yes
  become_method: sudo
  tasks:
  - import_tasks: ../tasks/create-data-volume.yml
    vars:
      lv_name: webserver
      lv_size: 145g
      mountpoint: /srv

  - name: /srv/download.baserock.org/
    file:
      path: /srv/download.baserock.org/
      owner: "{{ ansible_user_id }}"
      state: directory

  - name: Create the nginx configuration files
    template:
      src: files/{{ item }}
      dest: /etc/nginx/sites-available/{{ item }}
    become: yes
    notify:
    - restart nginx
    with_items:
    - download-baserock-org.conf
    - irclogs-baserock-org.conf

  - name: Enable nginx sites
    file:
      src: ../sites-available/{{ item }}
      dest: /etc/nginx/sites-enabled/{{ item }}
      state: link
    become: yes
    notify:
    - restart nginx
    with_items:
    - download-baserock-org.conf
    - irclogs-baserock-org.conf

  handlers:
  - name: restart nginx
    service:
      name: nginx
      state: restarted
    become: yes