init
This commit is contained in:
commit
883f31932e
169 changed files with 5676 additions and 0 deletions
37
ansible/roles/host/tasks/setup-swap.yml
Normal file
37
ansible/roles/host/tasks/setup-swap.yml
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
-
|
||||
name: Ensure swap exists
|
||||
command: fallocate -l {{ swap_size | default('2G') }} /swapfile
|
||||
args:
|
||||
creates: /swapfile
|
||||
|
||||
-
|
||||
name: Set swap permissions
|
||||
file:
|
||||
path: /swapfile
|
||||
mode: '0600'
|
||||
|
||||
-
|
||||
name: Make swap
|
||||
command: mkswap /swapfile
|
||||
args:
|
||||
creates: /swapfile.swap
|
||||
|
||||
-
|
||||
name: Mark swapfile as initialized
|
||||
file:
|
||||
path: /swapfile.swap
|
||||
state: touch
|
||||
|
||||
-
|
||||
name: Enable swap
|
||||
command: swapon /swapfile
|
||||
register: swap_on
|
||||
failed_when: false
|
||||
|
||||
-
|
||||
name: Add swap to fstab
|
||||
lineinfile:
|
||||
path: /etc/fstab
|
||||
line: "/swapfile none swap sw 0 0"
|
||||
state: present
|
||||
Loading…
Add table
Add a link
Reference in a new issue