xoxys.swap/tasks/create.yml
Robert Kaussow f2c009b42d
All checks were successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/push/docs Pipeline was successful
ci/woodpecker/push/notify Pipeline was successful
refctor: rework ci to ue ansible-lint and fix molecule
2024-08-19 16:06:16 +02:00

29 lines
683 B
YAML

---
- name: Create swap file
ansible.builtin.command: "fallocate -l {{ swap_size }}M {{ swap_path }}"
changed_when: False
when: swap_size | int > (ansible_swaptotal_mb | int) + 1
- name: Format swap file
ansible.builtin.command: "mkswap {{ swap_path }}"
changed_when: False
when: swap_size | int > (ansible_swaptotal_mb | int) + 1
- name: Fix file permissions
ansible.builtin.file:
path: "{{ swap_path }}"
owner: root
group: root
mode: "0600"
- name: Mount swap file
ansible.posix.mount:
src: "{{ swap_path }}"
path: none
fstype: swap
state: present
- name: Enable swap
ansible.builtin.command: "swapon -a"
changed_when: False