Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
K3S Ansible
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Дмитрий Сафронов
K3S Ansible
Commits
9422f65b
Commit
9422f65b
authored
4 years ago
by
David Putzolu
Browse files
Options
Downloads
Patches
Plain Diff
Make cgroup enabling idempotent and fix ansible lint checks.
parent
58d847a7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
roles/ubuntu/tasks/main.yml
+6
-18
6 additions, 18 deletions
roles/ubuntu/tasks/main.yml
with
6 additions
and
18 deletions
roles/ubuntu/tasks/main.yml
+
6
−
18
View file @
9422f65b
---
-
name
:
Check if cgroups enabled
shell
:
cat /boot/firmware/cmdline.txt | grep cgroup
register
:
cgroup_enabled
when
:
ansible_distribution == 'Ubuntu'
# grep will exit with 1 when no results found.
# ignore_errors causes the task not to halt play.
ignore_errors
:
true
-
name
:
Enable cgroup via boot commandline if not already enabled
lineinfile
:
path
:
/boot/firmware/cmdline.txt
backrefs
:
yes
regexp
:
"
(
.*)$
"
regexp
:
'
^((?!.*\bcgroup_enable=cpuset
cgroup_memory=1
cgroup_enable=memory\b)
.*)$
'
line
:
'
\1
cgroup_enable=cpuset
cgroup_memory=1
cgroup_enable=memory'
when
:
-
ansible_distribution == 'Ubuntu'
-
cgroup_enabled.stdout == ""
-
name
:
C
heck
i
f cgroups already running
shell
:
cat /proc/cmdline
| grep cgroup
register
:
c
group_runn
in
g
-
name
:
Read /proc/cmdline to c
heck f
or
cgroups already running
shell
:
cat /proc/cmdline
register
:
c
mdl
in
e
when
:
ansible_distribution == 'Ubuntu'
# grep will exit with 1 when no results found.
# ignore_errors causes the task not to halt play.
ignore_errors
:
true
-
ansible_distribution == 'Ubuntu'
-
name
:
Reboot to enable cgroups if not already running
reboot
:
when
:
-
ansible_distribution == 'Ubuntu'
-
cgroup_
running
.stdout
== ""
-
'
"
cgroup_
enable=cpuset
cgroup_memory=1
cgroup_enable=memory"
not
in
cmdline
.stdout
'
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment