mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-10-10 02:38:10 +02:00
Refactor svc-opt-swapfile role: move core logic into 01_core.yml, simplify tasks/main.yml, and integrate swapfile setup into sys-svc-docker/01_core.yml to prevent OOM failures. See https://chatgpt.com/share/68d518f2-ba0c-800f-8a3a-c6b045763ac6
This commit is contained in:
18
roles/svc-opt-swapfile/tasks/01_core.yml
Normal file
18
roles/svc-opt-swapfile/tasks/01_core.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
- name: Include dependency 'pkgmgr-install'
|
||||
include_role:
|
||||
name: pkgmgr-install
|
||||
when: run_once_pkgmgr_install is not defined
|
||||
|
||||
- name: "pkgmgr install"
|
||||
include_role:
|
||||
name: pkgmgr-install
|
||||
vars:
|
||||
package_name: swap-forge
|
||||
|
||||
- name: Execute create swapfile script
|
||||
shell: swap-forge "{{ SWAPFILE_SIZE }}"
|
||||
become: true
|
||||
async: "{{ ASYNC_TIME if ASYNC_ENABLED | bool else omit }}"
|
||||
poll: "{{ ASYNC_POLL if ASYNC_ENABLED | bool else omit }}"
|
||||
|
||||
- include_tasks: utils/run_once.yml
|
@@ -1,19 +1,3 @@
|
||||
- block:
|
||||
- name: Include dependency 'pkgmgr-install'
|
||||
include_role:
|
||||
name: pkgmgr-install
|
||||
when: run_once_pkgmgr_install is not defined
|
||||
- include_tasks: utils/run_once.yml
|
||||
- include_tasks: 01_core.yml
|
||||
when: run_once_svc_opt_swapfile is not defined
|
||||
|
||||
- name: "pkgmgr install"
|
||||
include_role:
|
||||
name: pkgmgr-install
|
||||
vars:
|
||||
package_name: swap-forge
|
||||
|
||||
- name: Execute create swapfile script
|
||||
shell: swap-forge "{{ SWAPFILE_SIZE }}"
|
||||
become: true
|
||||
async: "{{ ASYNC_TIME if ASYNC_ENABLED | bool else omit }}"
|
||||
poll: "{{ ASYNC_POLL if ASYNC_ENABLED | bool else omit }}"
|
@@ -6,6 +6,12 @@
|
||||
state: present
|
||||
notify: docker restart
|
||||
|
||||
- name: Setup Swapfile to prevent OOM Failures
|
||||
# @ See https://en.wikipedia.org/wiki/Out_of_memory
|
||||
include_role:
|
||||
name: "svc-opt-swapfile"
|
||||
when: run_once_svc_opt_swapfile is not defined
|
||||
|
||||
- name: "Load reset tasks when MODE_RESET is enabled"
|
||||
include_tasks: "02_reset.yml"
|
||||
when: MODE_RESET | bool
|
||||
|
Reference in New Issue
Block a user