This commit is contained in:
mark committed 2026-09-04 10:52:50 +02:00
1 parent 1782a9bf47
commit 7e8898a042
3 files changed
+51

No files matched your search

+3
View File
@@ -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
+2
View File
@@ -117,6 +117,8 @@
group: aurbis
mode: "0775"
loop: [nextcloud, hdwiki, gitea, authentik, drone, "hoekveen.net"]
- import_tasks: tasks/swapfile.yml
tags: swap
- import_tasks: tasks/nextcloud.yml
tags: nextcloud
- import_tasks: tasks/hdwiki.yml
+46
View File
@@ -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"