Compare commits
13
Commits
55591374b2
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
209556f98e | ||
|
|
dad0355f8c | ||
|
|
6b30aa23e5 | ||
|
|
f89b640135 | ||
|
|
15b22bc5a4 | ||
|
|
f9dfba3f33 | ||
|
|
2dc4b4443a | ||
|
|
26449924b8 | ||
|
|
fffc009ab9 | ||
|
|
c06ab18da9 | ||
|
|
7e8898a042 | ||
|
|
1782a9bf47 | ||
|
|
682d8d571c |
No files matched your search
@@ -0,0 +1,6 @@
|
||||
# The Aurbis
|
||||
|
||||
> At first the Aurbis was turbulent and confusing, as Anuiel's ruminations went on without design. Aspects of the Aurbis then asked for a schedule to follow or procedures whereby they might enjoy themselves a little longer outside of perfect knowledge.
|
||||
|
||||
|
||||
> This is the flowering scheme of the Aurbis. This is the promise of the PSJJJJ: egg, image, man, god, city, state. I serve and am served. I am made of wire and string and mortar and I accede my own precedent, world without am.'
|
||||
@@ -0,0 +1,2 @@
|
||||
gitea_ssh: gitea@git.hoekveen.net
|
||||
gitea_https: https://git.hoekveen.net
|
||||
@@ -27,3 +27,8 @@
|
||||
service:
|
||||
name: nginx
|
||||
state: reloaded
|
||||
|
||||
- name: restart fail2ban
|
||||
service:
|
||||
name: fail2ban
|
||||
state: restarted
|
||||
@@ -4,6 +4,9 @@ users:
|
||||
- jp
|
||||
- lourens
|
||||
- guus
|
||||
# nightingale's analyzer peaks around 11G RSS during forced alignment, on 11G of RAM.
|
||||
swapfile_size_gb: 24
|
||||
|
||||
cloud_nginx_tls: true
|
||||
cloud_nginx_sites:
|
||||
- name: nextcloud
|
||||
@@ -24,14 +27,18 @@ cloud_nginx_sites:
|
||||
port: 3496
|
||||
- name: www
|
||||
server_name: www.hoekveen.net
|
||||
aliases: [hoekveen.net]
|
||||
root: /opt/hoekveen.net
|
||||
- name: nightingale
|
||||
server_name: karaoke.hoekveen.net
|
||||
port: 8087
|
||||
max_body: 2g # song uploads
|
||||
|
||||
fail2ban_ignoreip:
|
||||
- home.hoekveen.net
|
||||
|
||||
stroopwafel_dir: /opt/stroopwafel
|
||||
stroopwafel_repo: gitea@git.hoekveen.net:mark/stroopwafel.git
|
||||
stroopwafel_repo: mark/stroopwafel
|
||||
stroopwafel_version: master
|
||||
|
||||
backup_dump_dir: /var/backups/aurbis
|
||||
|
||||
+24
-8
@@ -61,12 +61,20 @@
|
||||
tasks:
|
||||
- name: Update
|
||||
include_tasks: tasks/install_docker_debian.yml
|
||||
- name: Aurbis access to /opt
|
||||
hosts: all
|
||||
become: true
|
||||
remote_user: nerevar
|
||||
tasks:
|
||||
- import_tasks: tasks/aurbis.yml
|
||||
tags: aurbis
|
||||
- name: Add utility scripts
|
||||
hosts: all
|
||||
become: true
|
||||
remote_user: nerevar
|
||||
tasks:
|
||||
- import_tasks: tasks/scripts.yml
|
||||
tags: scripts
|
||||
- name: Setup zsh
|
||||
hosts: debian
|
||||
become: true
|
||||
@@ -109,20 +117,28 @@
|
||||
package:
|
||||
name: [rsync, curl, sqlite3]
|
||||
state: present
|
||||
- name: Normalise /opt app ownership to root:aurbis (top dir only, not recursive)
|
||||
file:
|
||||
path: "/opt/{{ item }}"
|
||||
state: directory
|
||||
owner: root
|
||||
group: aurbis
|
||||
mode: "0775"
|
||||
loop: [nextcloud, hdwiki, gitea, authentik, drone, "hoekveen.net"]
|
||||
- import_tasks: tasks/aurbis_tree.yml
|
||||
vars:
|
||||
tree_path: /opt/hoekveen.net
|
||||
tags: aurbis
|
||||
- import_tasks: tasks/swapfile.yml
|
||||
tags: swap
|
||||
- import_tasks: tasks/nextcloud.yml
|
||||
tags: nextcloud
|
||||
- import_tasks: tasks/hdwiki.yml
|
||||
tags: hdwiki
|
||||
- import_tasks: tasks/gitea.yml
|
||||
tags: gitea
|
||||
- import_tasks: tasks/authentik.yml
|
||||
tags: authentik
|
||||
- import_tasks: tasks/nightingale.yml
|
||||
tags: nightingale
|
||||
- import_tasks: tasks/stroopwafel.yml
|
||||
tags: stroopwafel
|
||||
- import_tasks: tasks/fail2ban.yml
|
||||
tags: fail2ban
|
||||
- import_tasks: tasks/cloud_nginx.yml
|
||||
tags: nginx
|
||||
- name: Ensure the backup user can run the forced-command pull
|
||||
user:
|
||||
name: backup
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
# Service data below the top level stays with whatever uid its container runs as.
|
||||
- name: Let aurbis create services in /opt
|
||||
file:
|
||||
path: /opt
|
||||
state: directory
|
||||
owner: root
|
||||
group: aurbis
|
||||
mode: "02775"
|
||||
- name: Give aurbis every /opt service directory
|
||||
ansible.builtin.command:
|
||||
argv: [find, /opt, -mindepth, "1", -maxdepth, "1", -type, d, "!", -name, containerd,
|
||||
"!", "(", -group, aurbis, -perm, "-2070", ")",
|
||||
-print, -exec, chgrp, aurbis, "{}", "+", -exec, chmod, g+rwxs, "{}", "+"]
|
||||
register: aurbis_opt_dirs
|
||||
changed_when: aurbis_opt_dirs.stdout != ""
|
||||
- name: Give aurbis the top-level files of every /opt service
|
||||
ansible.builtin.command:
|
||||
argv: [find, /opt, -mindepth, "2", -maxdepth, "2", -type, f, "!", -path, "/opt/containerd/*",
|
||||
"!", "(", -group, aurbis, -perm, -g+rw, ")",
|
||||
-print, -exec, chgrp, aurbis, "{}", "+", -exec, chmod, g+rw, "{}", "+"]
|
||||
register: aurbis_opt_files
|
||||
changed_when: aurbis_opt_files.stdout != ""
|
||||
- name: Keep /opt .env files from other users
|
||||
ansible.builtin.command:
|
||||
argv: [find, /opt, -mindepth, "2", -maxdepth, "2", -type, f, -name, .env, -perm, /o+rwx,
|
||||
-print, -exec, chmod, o-rwx, "{}", "+"]
|
||||
register: aurbis_opt_env
|
||||
changed_when: aurbis_opt_env.stdout != ""
|
||||
|
||||
- name: Look up the docker group
|
||||
getent:
|
||||
database: group
|
||||
key: docker
|
||||
fail_key: false
|
||||
- name: Let aurbis members run docker
|
||||
user:
|
||||
name: "{{ item }}"
|
||||
groups: docker
|
||||
append: true
|
||||
loop: "{{ users | default([]) }}"
|
||||
when: ansible_facts.getent_group.docker is not none
|
||||
@@ -0,0 +1,12 @@
|
||||
- name: Give aurbis write access to {{ tree_path }}
|
||||
file:
|
||||
path: "{{ tree_path }}"
|
||||
state: directory
|
||||
recurse: true
|
||||
group: aurbis
|
||||
mode: g+rwX
|
||||
- name: Make {{ tree_path }} directories hand their group to new files
|
||||
ansible.builtin.command:
|
||||
cmd: "find {{ tree_path }} -type d ! -perm -g+s -print -exec chmod g+s {} +"
|
||||
register: aurbis_tree_setgid
|
||||
changed_when: aurbis_tree_setgid.stdout != ""
|
||||
@@ -0,0 +1,22 @@
|
||||
- name: Include authentik vault
|
||||
include_vars:
|
||||
dir: authentik
|
||||
files_matching: vault.yml
|
||||
- name: Create authentik directory
|
||||
file:
|
||||
path: /opt/authentik
|
||||
state: directory
|
||||
owner: root
|
||||
group: aurbis
|
||||
mode: "02775"
|
||||
- name: Template authentik env
|
||||
template:
|
||||
src: authentik/env.j2
|
||||
dest: /opt/authentik/.env
|
||||
owner: root
|
||||
group: aurbis
|
||||
mode: "0660"
|
||||
- name: Deploy authentik
|
||||
include_tasks: tasks/docker_service.yml
|
||||
vars:
|
||||
service_name: authentik
|
||||
@@ -0,0 +1,62 @@
|
||||
services:
|
||||
postgresql:
|
||||
image: docker.io/library/postgres:16-alpine
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
|
||||
start_period: 20s
|
||||
interval: 30s
|
||||
retries: 5
|
||||
timeout: 5s
|
||||
volumes:
|
||||
- database:/var/lib/postgresql/data
|
||||
environment:
|
||||
POSTGRES_USER: authentik
|
||||
POSTGRES_DB: authentik
|
||||
POSTGRES_PASSWORD: ${PG_PASS:?database password required}
|
||||
env_file:
|
||||
- .env
|
||||
server:
|
||||
image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG}
|
||||
restart: unless-stopped
|
||||
command: server
|
||||
environment:
|
||||
AUTHENTIK_POSTGRESQL__HOST: postgresql
|
||||
AUTHENTIK_POSTGRESQL__USER: authentik
|
||||
AUTHENTIK_POSTGRESQL__NAME: authentik
|
||||
AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS}
|
||||
volumes:
|
||||
- ./data/media:/data/media
|
||||
- ./custom-templates:/templates
|
||||
env_file:
|
||||
- .env
|
||||
ports:
|
||||
- "127.0.0.1:9000:9000"
|
||||
- "127.0.0.1:9443:9443"
|
||||
depends_on:
|
||||
postgresql:
|
||||
condition: service_healthy
|
||||
worker:
|
||||
image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG}
|
||||
restart: unless-stopped
|
||||
command: worker
|
||||
environment:
|
||||
AUTHENTIK_POSTGRESQL__HOST: postgresql
|
||||
AUTHENTIK_POSTGRESQL__USER: authentik
|
||||
AUTHENTIK_POSTGRESQL__NAME: authentik
|
||||
AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS}
|
||||
# Fixes ownership of the mounted dirs on start
|
||||
user: root
|
||||
volumes:
|
||||
- ./data/media:/data/media
|
||||
- ./certs:/certs
|
||||
- ./custom-templates:/templates
|
||||
env_file:
|
||||
- .env
|
||||
depends_on:
|
||||
postgresql:
|
||||
condition: service_healthy
|
||||
|
||||
volumes:
|
||||
database:
|
||||
driver: local
|
||||
@@ -0,0 +1,14 @@
|
||||
AUTHENTIK_TAG=2026.8.5
|
||||
|
||||
PG_PASS={{ authentik_pg_password }}
|
||||
AUTHENTIK_SECRET_KEY={{ authentik_secret_key }}
|
||||
AUTHENTIK_ERROR_REPORTING__ENABLED=true
|
||||
|
||||
AUTHENTIK_EMAIL__HOST=send.one.com
|
||||
AUTHENTIK_EMAIL__PORT=465
|
||||
AUTHENTIK_EMAIL__USERNAME=authentik@hoekveen.net
|
||||
AUTHENTIK_EMAIL__PASSWORD={{ authentik_email_password }}
|
||||
AUTHENTIK_EMAIL__USE_TLS=false
|
||||
AUTHENTIK_EMAIL__USE_SSL=true
|
||||
AUTHENTIK_EMAIL__TIMEOUT=10
|
||||
AUTHENTIK_EMAIL__FROM=Hoekveen.net SSO <authentik@hoekveen.net>
|
||||
@@ -0,0 +1,14 @@
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
33373361623039323032623234343336313932303732656433383566633439356464653066363165
|
||||
3230316336373563313636306162343030643634363965300a663662353633666363666234613933
|
||||
64643034646534393131356637373930303266636361643565656239633863363366386331333461
|
||||
3338633433306336660a363036643538383763386331316362363730386439623836643536346462
|
||||
32393530376232663838653831373665356664373965396238363432313465613238613533326235
|
||||
61316630336535353538393261376533326132643765366463623830653065313033386438396338
|
||||
36643262373636343830376566633133393139633634393366643762393136316437663735623561
|
||||
63306130363731396432366539336661343061313466656138613465623234333464356431613563
|
||||
33396562366130633130646639373333616566613966373937613462316133373835333836346564
|
||||
63393634363064666230343432313366353263373862353036333038313035636365623361636331
|
||||
35653462303033613331336439666135386437363234376562366161626435303862343065613434
|
||||
36316266313838643361663762636339616166366561643262383437626339306362376635383166
|
||||
38333733326161616235326662373438343030303336666264623839386461306533
|
||||
@@ -1,9 +1,10 @@
|
||||
# {{ ansible_managed }}
|
||||
{% set server_names = ([item.server_name] + item.aliases | default([])) | join(' ') %}
|
||||
{% if cloud_nginx_tls | default(false) %}
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name {{ item.server_name }};
|
||||
server_name {{ server_names }};
|
||||
# ACME http-01 renewals keep working over plain http
|
||||
location /.well-known/acme-challenge/ { root /var/www/letsencrypt; }
|
||||
location / { return 301 https://$host$request_uri; }
|
||||
@@ -21,7 +22,7 @@ server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
{% endif %}
|
||||
server_name {{ item.server_name }};
|
||||
server_name {{ server_names }};
|
||||
|
||||
client_max_body_size {{ item.max_body | default('512m') }};
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
state: directory
|
||||
owner: root
|
||||
group: "{{ service_group | default('aurbis') }}"
|
||||
mode: "0775"
|
||||
mode: "02775"
|
||||
- name: Copy docker-compose file
|
||||
template:
|
||||
src: "{{ service_name }}/docker-compose.yml.j2"
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
- name: Install fail2ban
|
||||
apt:
|
||||
name: [fail2ban, python3-systemd]
|
||||
state: present
|
||||
- name: Configure sshd jail
|
||||
template:
|
||||
src: fail2ban/sshd.local.j2
|
||||
dest: /etc/fail2ban/jail.d/sshd.local
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
notify: restart fail2ban
|
||||
- name: Enable fail2ban
|
||||
service:
|
||||
name: fail2ban
|
||||
state: started
|
||||
enabled: true
|
||||
@@ -0,0 +1,14 @@
|
||||
[DEFAULT]
|
||||
backend = systemd
|
||||
banaction = nftables-multiport
|
||||
banaction_allports = nftables-allports
|
||||
ignoreip = {{ (['127.0.0.1/8', '::1'] + fail2ban_ignoreip | default([])) | join(' ') }}
|
||||
bantime = {{ fail2ban_bantime | default('1h') }}
|
||||
bantime.increment = true
|
||||
bantime.maxtime = {{ fail2ban_bantime_max | default('1w') }}
|
||||
findtime = {{ fail2ban_findtime | default('10m') }}
|
||||
maxretry = {{ fail2ban_maxretry | default(5) }}
|
||||
|
||||
[sshd]
|
||||
enabled = true
|
||||
port = ssh
|
||||
@@ -1,7 +1,7 @@
|
||||
# Git-over-ssh stays on the host sshd port 22 via passthrough
|
||||
services:
|
||||
db:
|
||||
image: mariadb:11.8
|
||||
image: mariadb:11.8.9
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
MARIADB_DATABASE: gitea
|
||||
@@ -15,7 +15,7 @@ services:
|
||||
interval: 10s
|
||||
retries: 12
|
||||
gitea:
|
||||
image: docker.gitea.com/gitea:1.26.4
|
||||
image: docker.gitea.com/gitea:28.2.0
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
db:
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
# Shared checkout of a gitea repo: root seeds and fast-forwards it over anonymous
|
||||
# https, aurbis members push and pull over ssh with their own gitea key.
|
||||
- name: Create {{ checkout_repo }} directory
|
||||
file:
|
||||
path: "{{ checkout_dest }}"
|
||||
state: directory
|
||||
owner: root
|
||||
group: aurbis
|
||||
mode: "02775"
|
||||
- name: Seed {{ checkout_repo }}
|
||||
ansible.builtin.git:
|
||||
repo: "{{ gitea_https }}/{{ checkout_repo }}.git"
|
||||
dest: "{{ checkout_dest }}"
|
||||
version: "{{ checkout_version | default('master') }}"
|
||||
update: false
|
||||
force: false
|
||||
- name: Point {{ checkout_repo }} origin at git-over-ssh
|
||||
community.general.git_config:
|
||||
name: remote.origin.url
|
||||
scope: local
|
||||
repo: "{{ checkout_dest }}"
|
||||
value: "{{ gitea_ssh }}:{{ checkout_repo }}.git"
|
||||
- name: Have git keep {{ checkout_repo }} group-writable
|
||||
community.general.git_config:
|
||||
name: core.sharedRepository
|
||||
scope: local
|
||||
repo: "{{ checkout_dest }}"
|
||||
value: group
|
||||
- name: Add {{ checkout_repo }} to safe.directory
|
||||
community.general.git_config:
|
||||
name: safe.directory
|
||||
scope: system
|
||||
add_mode: add
|
||||
value: "{{ checkout_dest }}"
|
||||
# ff-only, so unpushed commits or conflicting edits on the host fail the run instead of being lost.
|
||||
- name: Fast-forward {{ checkout_repo }}
|
||||
ansible.builtin.shell:
|
||||
chdir: "{{ checkout_dest }}"
|
||||
cmd: |
|
||||
set -e
|
||||
umask 002
|
||||
before=$(git rev-parse HEAD)
|
||||
git fetch -q {{ gitea_https }}/{{ checkout_repo }}.git +refs/heads/{{ checkout_version | default('master') }}:refs/remotes/origin/{{ checkout_version | default('master') }}
|
||||
git merge -q --ff-only origin/{{ checkout_version | default('master') }}
|
||||
[ "$before" = "$(git rev-parse HEAD)" ] || echo updated
|
||||
register: checkout_pull
|
||||
changed_when: "'updated' in checkout_pull.stdout"
|
||||
when: checkout_update | default(true)
|
||||
- import_tasks: aurbis_tree.yml
|
||||
vars:
|
||||
tree_path: "{{ checkout_dest }}"
|
||||
@@ -1,6 +1,6 @@
|
||||
services:
|
||||
db:
|
||||
image: mariadb:11.8
|
||||
image: mariadb:11.8.9
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
MARIADB_DATABASE: mediawikidb
|
||||
@@ -18,7 +18,7 @@ services:
|
||||
build:
|
||||
context: .
|
||||
dockerfile_inline: |
|
||||
FROM mediawiki:1.45.4
|
||||
FROM mediawiki:1.45.6
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends ffmpeg \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
state: directory
|
||||
owner: root
|
||||
group: aurbis
|
||||
mode: "0775"
|
||||
mode: "02775"
|
||||
|
||||
- name: Create mosquitto config directory
|
||||
file:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
services:
|
||||
jellyfin:
|
||||
image: jellyfin/jellyfin:10.11
|
||||
image: jellyfin/jellyfin:12.0
|
||||
container_name: jellyfin
|
||||
# Optional - specify the uid and gid you would like Jellyfin to use instead of root
|
||||
user: 0:1003
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
services:
|
||||
db:
|
||||
image: mariadb:11.8
|
||||
image: mariadb:11.8.9
|
||||
restart: unless-stopped
|
||||
command: --transaction-isolation=READ-COMMITTED
|
||||
environment:
|
||||
@@ -15,10 +15,10 @@ services:
|
||||
interval: 10s
|
||||
retries: 12
|
||||
redis:
|
||||
image: redis:alpine
|
||||
image: redis:8.8.4-alpine
|
||||
restart: unless-stopped
|
||||
nextcloud:
|
||||
image: nextcloud:34.0.1-apache
|
||||
image: nextcloud:34.0.5-apache
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
db:
|
||||
@@ -35,7 +35,7 @@ services:
|
||||
TRUSTED_PROXIES: "172.16.0.0/12"
|
||||
APACHE_DISABLE_REWRITE_IP: 1
|
||||
cron:
|
||||
image: nextcloud:34.0.1-apache
|
||||
image: nextcloud:34.0.5-apache
|
||||
restart: unless-stopped
|
||||
entrypoint: /cron.sh
|
||||
depends_on:
|
||||
|
||||
+14
-1
@@ -4,7 +4,7 @@
|
||||
state: directory
|
||||
owner: root
|
||||
group: aurbis
|
||||
mode: "0775"
|
||||
mode: "02775"
|
||||
|
||||
# Song library. Read-only for nightingale.
|
||||
# Keep this in sync with the /karaoke mount in nextcloud
|
||||
@@ -17,6 +17,19 @@
|
||||
group: www-data
|
||||
mode: "02775"
|
||||
|
||||
# Processed-song cache. Bind-mounted into the container at /data/cache and
|
||||
# reachable over sshfs so songs can be analyzed on a machine with more RAM and
|
||||
# the results dropped straight in here. Owned by the container's uid (999, fixed
|
||||
# in razzaru/nightingale) so it can write as owner; group aurbis + setgid lets
|
||||
# aurbis members (sshfs) create/replace files too.
|
||||
- name: Create nightingale cache dir (shared with container uid 999 + aurbis)
|
||||
file:
|
||||
path: /opt/nightingale/cache
|
||||
state: directory
|
||||
owner: "999"
|
||||
group: aurbis
|
||||
mode: "02775"
|
||||
|
||||
- name: Template nightingale compose
|
||||
template:
|
||||
src: nightingale/docker-compose.yml.j2
|
||||
|
||||
@@ -2,13 +2,21 @@
|
||||
# CPU-only prebuilt image
|
||||
services:
|
||||
nightingale:
|
||||
image: razzaru/nightingale:latest
|
||||
image: razzaru/nightingale:1.3.0
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "127.0.0.1:8087:8080"
|
||||
# Keeps separation resident but forces the alignment spike into swap rather
|
||||
# than evicting the other stacks and hanging the host.
|
||||
mem_limit: 9g
|
||||
memswap_limit: 24g
|
||||
# /data/cache is bind-mounted so it can be reached over sshfs and songs
|
||||
# can be pre-processed on a machine with more RAM (see docs/aurbis.wiki).
|
||||
# Everything else (db, models, vendor) stays in the named volume.
|
||||
volumes:
|
||||
- data:/data
|
||||
- ./songs:/songs:ro
|
||||
- ./cache:/data/cache
|
||||
environment:
|
||||
NIGHTINGALE_LIBRARY_PATH: /songs
|
||||
|
||||
|
||||
+4
-15
@@ -1,15 +1,4 @@
|
||||
- name: Git clone
|
||||
ansible.builtin.git:
|
||||
repo: https://git.hoekveen.net/mark/scripts.git
|
||||
dest: /opt/scripts
|
||||
force: true
|
||||
- name: Set permissions and ownership for scripts folder
|
||||
file:
|
||||
path: /opt/scripts
|
||||
state: directory
|
||||
recurse: true
|
||||
group: aurbis
|
||||
mode: "0775"
|
||||
- name: Add scripts directory to safe.directory
|
||||
ansible.builtin.command:
|
||||
cmd: git config --system --add safe.directory /opt/scripts
|
||||
- import_tasks: gitea_checkout.yml
|
||||
vars:
|
||||
checkout_repo: mark/scripts
|
||||
checkout_dest: /opt/scripts
|
||||
+11
-18
@@ -1,31 +1,19 @@
|
||||
# Pulling needs to have git access; root does not.
|
||||
- name: Include stroopwafel vault
|
||||
include_vars:
|
||||
dir: stroopwafel
|
||||
files_matching: vault.yml
|
||||
- name: Create stroopwafel directory
|
||||
file:
|
||||
path: "{{ stroopwafel_dir }}"
|
||||
state: directory
|
||||
owner: root
|
||||
group: "{{ service_group | default('aurbis') }}"
|
||||
mode: "0775"
|
||||
- name: Check out stroopwafel source
|
||||
ansible.builtin.git:
|
||||
repo: "{{ stroopwafel_repo }}"
|
||||
dest: "{{ stroopwafel_dir }}"
|
||||
version: "{{ stroopwafel_version }}"
|
||||
update: "{{ stroopwafel_update | default(false) }}"
|
||||
accept_hostkey: true
|
||||
force: false
|
||||
become_user: "{{ stroopwafel_git_user | default(omit) }}"
|
||||
- import_tasks: gitea_checkout.yml
|
||||
vars:
|
||||
checkout_repo: "{{ stroopwafel_repo }}"
|
||||
checkout_dest: "{{ stroopwafel_dir }}"
|
||||
checkout_version: "{{ stroopwafel_version }}"
|
||||
- name: Deploy stroopwafel .env
|
||||
copy:
|
||||
content: "{{ stroopwafel_env_b64 | b64decode }}"
|
||||
dest: "{{ stroopwafel_dir }}/.env"
|
||||
owner: root
|
||||
group: "{{ service_group | default('aurbis') }}"
|
||||
mode: "0640"
|
||||
mode: "0660"
|
||||
when: stroopwafel_env_b64 is defined
|
||||
no_log: true
|
||||
- name: Copy docker-compose file
|
||||
@@ -39,3 +27,8 @@
|
||||
community.docker.docker_compose_v2:
|
||||
project_src: "{{ stroopwafel_dir }}"
|
||||
build: policy
|
||||
- name: Restart stroopwafel on new code
|
||||
community.docker.docker_compose_v2:
|
||||
project_src: "{{ stroopwafel_dir }}"
|
||||
state: restarted
|
||||
when: checkout_pull is changed
|
||||
@@ -5,3 +5,5 @@ services:
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- .:/opt/stroopwafel
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
@@ -0,0 +1,46 @@
|
||||
- name: Check swapfile
|
||||
stat:
|
||||
path: /swapfile
|
||||
register: swapfile
|
||||
|
||||
- name: Size swapfile
|
||||
when: not swapfile.stat.exists or swapfile.stat.size != swapfile_size_gb | int * 1024 * 1024 * 1024
|
||||
block:
|
||||
- name: Disable swapfile
|
||||
command: swapoff /swapfile
|
||||
when: swapfile.stat.exists
|
||||
changed_when: true
|
||||
- name: Remove old swapfile
|
||||
file:
|
||||
path: /swapfile
|
||||
state: absent
|
||||
- name: Allocate swapfile
|
||||
command: fallocate -l {{ swapfile_size_gb }}G /swapfile
|
||||
changed_when: true
|
||||
- name: Format swapfile
|
||||
command: mkswap /swapfile
|
||||
changed_when: true
|
||||
|
||||
- name: Restrict swapfile permissions
|
||||
file:
|
||||
path: /swapfile
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0600"
|
||||
|
||||
- name: Persist swapfile in fstab
|
||||
ansible.posix.mount:
|
||||
src: /swapfile
|
||||
path: none
|
||||
fstype: swap
|
||||
opts: sw
|
||||
state: present
|
||||
|
||||
- name: Check active swap
|
||||
command: swapon --show=NAME --noheadings
|
||||
register: swapfile_active
|
||||
changed_when: false
|
||||
|
||||
- name: Enable swapfile
|
||||
command: swapon /swapfile
|
||||
when: "'/swapfile' not in swapfile_active.stdout_lines"
|
||||
Reference in new issue
Block a user