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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
- name: Base setup for lotus-land-story
  hosts: lotus-land-story
  tasks:

    - name: Always mount the lotus-land-story volume
      ansible.builtin.lineinfile:
        dest: /etc/fstab
        line: >-
          /dev/disk/by-id/scsi-0Linode_Volume_lotus-land-story
          /mnt/lotus-land-story
          ext4
          defaults,noatime,nofail
          0 2
        state: present

    - name: Set hostname
      ansible.builtin.hostname:
        name: lotus-land-story

    # Temporary until the bookworm upgrade: bullseye is EOL and the expired
    # mirror breaks every apt refresh. Remove both tasks after the upgrade.
    # docs/lotus-land-story/2026-10-16-bullseye-to-bookworm.md
    - name: Point apt at the Debian archive
      ansible.builtin.copy:
        dest: /etc/apt/sources.list
        content: |
          deb http://archive.debian.org/debian bullseye main
          deb http://archive.debian.org/debian-security bullseye-security main
        mode: "0644"

    - name: Allow expired Release files
      ansible.builtin.copy:
        dest: /etc/apt/apt.conf.d/99archive-check-valid-until
        content: |
          Acquire::Check-Valid-Until "false";
        mode: "0644"

    - name: Install ansible requirements
      ansible.builtin.apt:
        pkg:
          - docker-compose
          - libpq-dev
          - python3-docker
          - python3-psycopg2
        state: present

    - name: Install basic packages
      ansible.builtin.apt:
        pkg:
          - prometheus-node-exporter
          # For debugging sustained network traffic.
          - iftop     # live per-connection bandwidth
          - nethogs   # live per-process bandwidth
          - tcpdump   # packet capture
          - vnstat    # persistent traffic accounting by interface
        state: present

- import_playbook: ../playbooks/tailscale.yml # noqa: name[play]
- import_playbook: ../playbooks/docker.yml    # noqa: name[play]

- import_playbook: docker.yml                 # noqa: name[play]

- import_playbook: postgres.yml               # noqa: name[play]
- import_playbook: redis.yml                  # noqa: name[play]

- name: Listen on the docker interface
  hosts: lotus-land-story
  tasks:

    - name: Set up postgres to listen on docker0 interface
      ansible.builtin.lineinfile:
        dest: /etc/postgresql/13/main/conf.d/listen.conf
        regexp: '^#?listen_addresses='
        line: "listen_addresses='localhost,{{ docker_ip.address }}'"
        state: present
        create: true
        mode: "0644"
      notify: Restart postgres

  handlers:
    - name: Import restarts
      ansible.builtin.import_tasks: restarts.yml

- import_playbook: grafana.yml     # noqa: name[play]
- import_playbook: miniflux.yml    # noqa: name[play]
- import_playbook: monica.yml      # noqa: name[play]
- import_playbook: gotosocial.yml  # noqa: name[play]
- import_playbook: ketchup.yml     # noqa: name[play]
- import_playbook: caddy.yml       # noqa: name[play]
- import_playbook: security.yml    # noqa: name[play]
- import_playbook: backup.yml      # noqa: name[play]
- import_playbook: homebox.yml     # noqa: name[play]
- import_playbook: vector.yml      # noqa: name[play]
- import_playbook: logs.yml        # noqa: name[play]
- import_playbook: otel.yml        # noqa: name[play]
- import_playbook: quire.yml       # noqa: name[play]
- import_playbook: pro-tacts.yml   # noqa: name[play]
- import_playbook: docket.yml      # noqa: name[play]

# vim: ft=yaml.ansible