-
-
Notifications
You must be signed in to change notification settings - Fork 392
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Manage /etc/security/limits.conf (#1036)
Add operation and fact to set and fetch values from /etc/security/limits.conf Co-authored-by: Nick Mills-Barrett <[email protected]>
- Loading branch information
Showing
4 changed files
with
205 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{ | ||
"command": "cat /etc/security/limits.conf", | ||
"output": [ | ||
"# <domain> <type> <item> <value>", | ||
"#* soft core ", | ||
"#root hard core 10000", | ||
"#* hard rss 1000", | ||
"#@student hard nproc 2", | ||
"#@faculty soft nproc 2", | ||
"#@faculty hard nproc 5", | ||
"#ftp hard nproc ", | ||
"#ftp - chroot /ft", | ||
"#@student - maxlogins ", | ||
"* soft nofile 104857", | ||
"* hard nofile 104857", | ||
"root soft nofile 104857", | ||
"root hard nofile 104857", | ||
"* soft memlock unlimite", | ||
"* hard memlock unlimite", | ||
"root soft memlock unlimite", | ||
"root hard memlock unlimite" | ||
], | ||
"fact": [ | ||
{ | ||
"domain": "*", | ||
"limit_type": "soft", | ||
"item": "nofile", | ||
"value": "104857" | ||
}, | ||
{ | ||
"domain": "*", | ||
"limit_type": "hard", | ||
"item": "nofile", | ||
"value": "104857" | ||
}, | ||
{ | ||
"domain": "root", | ||
"limit_type": "soft", | ||
"item": "nofile", | ||
"value": "104857" | ||
}, | ||
{ | ||
"domain": "root", | ||
"limit_type": "hard", | ||
"item": "nofile", | ||
"value": "104857" | ||
}, | ||
{ | ||
"domain": "*", | ||
"limit_type": "soft", | ||
"item": "memlock", | ||
"value": "unlimite" | ||
}, | ||
{ | ||
"domain": "*", | ||
"limit_type": "hard", | ||
"item": "memlock", | ||
"value": "unlimite" | ||
}, | ||
{ | ||
"domain": "root", | ||
"limit_type": "soft", | ||
"item": "memlock", | ||
"value": "unlimite" | ||
}, | ||
{ | ||
"domain": "root", | ||
"limit_type": "hard", | ||
"item": "memlock", | ||
"value": "unlimite" | ||
} | ||
] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"kwargs": { | ||
"domain": "root", | ||
"limit_type": "hard", | ||
"item": "memlock", | ||
"value": "unlimited" | ||
}, | ||
"facts": {"files.FindInFile": {}}, | ||
"commands": [ | ||
"if [ -f /etc/security/limits.conf ]; then ( grep '^root[[:space:]]+hard[[:space:]]+memlock.*$' /etc/security/limits.conf && sed -i.a-timestamp 's/^root[[:space:]]+hard[[:space:]]+memlock.*$/root\thard\tmemlock\tunlimited/' /etc/security/limits.conf && rm -f /etc/security/limits.conf.a-timestamp ) 2> /dev/null || echo 'root\thard\tmemlock\tunlimited' >> /etc/security/limits.conf ; else echo 'root\thard\tmemlock\tunlimited' >> /etc/security/limits.conf ; fi" | ||
] | ||
} |