builder3 is the new shit

This commit is contained in:
Daniel Frank 2021-12-29 18:14:49 +01:00
parent 44f89a9c45
commit 14a98b7d86
Signed by: tokudan
GPG key ID: 063CCCAD04182D32
3 changed files with 21 additions and 15 deletions

View file

@ -1,7 +1,7 @@
--- ---
- name: builder2 - name: builder3
hosts: builder2 hosts: builder3.hamburg.freifunk.net
tasks: tasks:
- name: Common system setup - name: Common system setup
block: block:
@ -81,6 +81,12 @@
- zfs-dkms - zfs-dkms
- zfs-zed - zfs-zed
- name: Ensure zfs modules are loaded on boot
lineinfile:
path: /etc/modules
line: zfs
regexp: zfs
- name: Reboot after ZFS install - name: Reboot after ZFS install
when: zfs_packages.changed when: zfs_packages.changed
reboot: reboot:
@ -92,7 +98,7 @@
failed_when: false failed_when: false
changed_when: try_import_zpool.rc == 0 changed_when: try_import_zpool.rc == 0
command: command:
cmd: zpool import build cmd: zpool import dpool
- name: Check if zpool is imported - name: Check if zpool is imported
register: zpool_import_status register: zpool_import_status
@ -100,23 +106,23 @@
changed_when: false changed_when: false
check_mode: false check_mode: false
command: command:
cmd: zpool list build cmd: zpool list dpool
- name: Create zpool if not imported - name: Create zpool if not imported
when: (zpool_import_status.rc > 0) when: (zpool_import_status.rc > 0)
command: command:
cmd: zpool create -o ashift=12 -o autotrim=on -O mountpoint=legacy -O dedup=on -O compression=on build /dev/disk/by-id/scsi-0HC_Volume_13728974 cmd: zpool create -o ashift=12 -o autotrim=on -O mountpoint=legacy -O dedup=on -O compression=on dpool mirror /dev/sda4 /dev/sdb4
- name: Create zfs datasets - name: Create zfs datasets
with_items: with_items:
- dataset: build - dataset: dpool
properties: properties:
org.debian:periodic-trim: enable org.debian:periodic-trim: enable
- dataset: build/build - dataset: dpool/build
properties: properties:
mountpoint: /build mountpoint: /build
com.sun:auto-snapshot: false com.sun:auto-snapshot: false
- dataset: build/firmware - dataset: dpool/firmware
properties: properties:
mountpoint: /firmware mountpoint: /firmware
com.sun:auto-snapshot: true com.sun:auto-snapshot: true
@ -124,7 +130,7 @@
com.sun:auto-snapshot:hourly: false com.sun:auto-snapshot:hourly: false
com.sun:auto-snapshot:weekly: false com.sun:auto-snapshot:weekly: false
com.sun:auto-snapshot:monthly: false com.sun:auto-snapshot:monthly: false
- dataset: build/mirror - dataset: dpool/mirror
properties: properties:
mountpoint: /mirror mountpoint: /mirror
com.sun:auto-snapshot: true com.sun:auto-snapshot: true
@ -184,7 +190,7 @@
state: link state: link
- name: Configure webserver for builder2 - name: Configure webserver for builder3
block: block:
- name: Install nginx - name: Install nginx
package: package:
@ -220,7 +226,7 @@
- name: Initialize certbot certificates standalone - name: Initialize certbot certificates standalone
command: command:
cmd: certbot -n --agree-tos --email certbot-test@danielfrank.net certonly --domains builder2.besaid.de --standalone cmd: certbot -n --agree-tos --email certbot-test@danielfrank.net certonly --domains builder3.hamburg.freifunk.net --standalone
- name: Setup cronjob for certbot - name: Setup cronjob for certbot
cron: cron:

View file

@ -1,2 +1,2 @@
[ffhh] [ffhh]
builder2 ansible_host=builder2.besaid.de builder3.hamburg.freifunk.net ansible_host=2a01:4f8:251:2f82::2

View file

@ -5,10 +5,10 @@ server {
listen 443 ssl default_server; listen 443 ssl default_server;
listen [::]:443 ssl default_server; listen [::]:443 ssl default_server;
server_name builder2.besaid.de; server_name builder3.hamburg.freifunk.net;
ssl_certificate /etc/letsencrypt/live/builder2.besaid.de/fullchain.pem; ssl_certificate /etc/letsencrypt/live/builder3.hamburg.freifunk.net/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/builder2.besaid.de/privkey.pem; ssl_certificate_key /etc/letsencrypt/live/builder3.hamburg.freifunk.net/privkey.pem;
root /firmware; root /firmware;