File tree Expand file tree Collapse file tree 3 files changed +66
-0
lines changed Expand file tree Collapse file tree 3 files changed +66
-0
lines changed Original file line number Diff line number Diff line change 33# SPDX-License-Identifier: MIT
44
55- import_playbook : auth.yml
6+ - import_playbook : system.yml
67- import_playbook : nginx.yml
78- import_playbook : docker.yml
89- import_playbook : codingteam.org.ru.yml
Original file line number Diff line number Diff line change 1+ # SPDX-FileCopyrightText: 2025 Friedrich von Never <[email protected] >2+ #
3+ # SPDX-License-Identifier: MIT
4+
5+ ---
6+ - name : Set up the system
7+ hosts : xmpp2
8+ become : true
9+
10+ vars :
11+ swap_file_path : ' /swapfile'
12+ swap_file_size : ' 2GiB'
13+
14+ tasks :
15+ - name : Check if swap file exists
16+ stat :
17+ path : ' {{ swap_file_path }}'
18+ register : swap_file_check
19+
20+ - name : Create swap file
21+ ansible.builtin.command : fallocate -l "{{ swap_file_size }}" "{{ swap_file_path }}"
22+ when : not swap_file_check.stat.exists
23+
24+ - name : Set up swap file permissions
25+ ansible.builtin.file :
26+ path : ' {{ swap_file_path }}'
27+ owner : root
28+ group : root
29+ mode : ' 0600'
30+
31+ - name : Prepare the swap file
32+ ansible.builtin.command : mkswap "{{ swap_file_path }}"
33+ when : not swap_file_check.stat.exists
34+
35+ - name : Mount the swap file
36+ ansible.posix.mount :
37+ path : none
38+ src : ' {{ swap_file_path }}'
39+ fstype : swap
40+ opts : sw
41+ passno : 0
42+ dump : 0
43+ state : present
44+
45+ - name : Enable swap
46+ command : swapon -a
47+ when : not swap_file_check.stat.exists
48+
49+ - name : Enable swappiness
50+ sysctl :
51+ name : vm.swappiness
52+ value : 1
You can’t perform that action at this time.
0 commit comments