Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3938406
init.sls
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
init.sls
View Options
# -------------------------------------------------------------
# Salt — Memory configuration
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# Created: 2020-02-12
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
# -------------------------------------------------------------
# Provide SWAP
#
# Some servers can't be set up without any swap, especially
# on Scaleway infrastructure. As a fallback, we can create
# a swap file in such cases.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{%
set
swap_size
=
8
*
1024
%}
{%
if
grains
[
'swap_total'
]
==
0
%}
create_swap_file
:
cmd.run
:
# dd is here used, as fallocate compatibility with XFS and ext4
# hasn't been verified.
-
name
:
dd if=/dev/zero of=/swapfile bs=1MiB count=
{{
swap_size
}}
-
creates
:
/swapfile
secure_swap_file
:
file.managed
:
-
name
:
/swapfile
-
mode
:
600
-
replace
:
False
enable_swap_file
:
cmd.run
:
-
name
:
|
mkswap /swapfile
swapon /swapfile
touch /etc/.swap-enabled
-
creates
:
/etc/.swap-enabled
configure_fstab_for_swap_file
:
file.append
:
-
name
:
/etc/fstab
-
text
:
/swapfile none swap sw 0 0
{%
endif
%}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 26, 01:51 (5 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2285089
Default Alt Text
init.sls (1 KB)
Attached To
Mode
rOPS Nasqueron Operations
Attached
Detach File
Event Timeline
Log In to Comment