summaryrefslogtreecommitdiff
path: root/chaos-at-home/ch-iot.yml
blob: 9a5d16414185da81a9a5012d2fad505924c0dbbf (plain) (blame)
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
---
- name: Basic Setup
  hosts: ch-iot
  roles:
  - role: apt-repo/base
  - role: core/base
  - role: core/sshd/base
  - role: core/zsh
  - role: core/ntp

- name: Payload Setup
  hosts: ch-iot
  roles:
  - role: apt-repo/spreadspace
  - role: x509/managed-ca/base
  - role: x509/managed-ca/ca
  - role: network/nftables/base
  - role: network/coredns
  - role: mosquitto/broker
  - role: nginx/base
  - role: monitoring/prometheus/exporter
  post_tasks:
  - name: create systemd override directory for nginx service unit
    file:
      path: /etc/systemd/system/nginx.service.d
      state: directory

  - name: create overrides for nginx systemd unit
    copy:
      content: |
        [Unit]
        After=network-online.target
        Wants=network-online.target
      dest: /etc/systemd/system/nginx.service.d/after-network-online.conf

  - name: configure default vhost web.chaos-at-home.org
    vars:
      nginx_vhost:
        name: iot-default
        default: yes
        listen:
        - "{{ network_zones.iot.prefix | ansible.utils.ipaddr(network_zones.iot.offsets[inventory_hostname]) | ansible.utils.ipaddr('address') }}:80"
        template: generic
        locations:
          '/':
            return: 404
    include_role:
      name: nginx/vhost

  - name: configure reverse-proxy for apt-cache
    vars:
      nginx_vhost:
        name: apt.chaos-at-home.org
        listen:
        - "{{ network_zones.iot.prefix | ansible.utils.ipaddr(network_zones.iot.offsets[inventory_hostname]) | ansible.utils.ipaddr('address') }}:80"
        hostnames:
        - apt.chaos-at-home.org
        template: generic
        locations:
          '/':
            proxy_pass: "http://apt.chaos-at-home.org/"
    include_role:
      name: nginx/vhost