swapfile
This commit is contained in:
1 parent
1782a9bf47
commit
7e8898a042
3 files changed
+51
No files matched your search
@@ -4,6 +4,9 @@ users:
|
|||||||
- jp
|
- jp
|
||||||
- lourens
|
- lourens
|
||||||
- guus
|
- 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_tls: true
|
||||||
cloud_nginx_sites:
|
cloud_nginx_sites:
|
||||||
- name: nextcloud
|
- name: nextcloud
|
||||||
|
|||||||
@@ -117,6 +117,8 @@
|
|||||||
group: aurbis
|
group: aurbis
|
||||||
mode: "0775"
|
mode: "0775"
|
||||||
loop: [nextcloud, hdwiki, gitea, authentik, drone, "hoekveen.net"]
|
loop: [nextcloud, hdwiki, gitea, authentik, drone, "hoekveen.net"]
|
||||||
|
- import_tasks: tasks/swapfile.yml
|
||||||
|
tags: swap
|
||||||
- import_tasks: tasks/nextcloud.yml
|
- import_tasks: tasks/nextcloud.yml
|
||||||
tags: nextcloud
|
tags: nextcloud
|
||||||
- import_tasks: tasks/hdwiki.yml
|
- import_tasks: tasks/hdwiki.yml
|
||||||
|
|||||||
@@ -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