Use ansible_cmdline to detect cgroup status
This commit is contained in:
parent
496081ebca
commit
8f6b8b1e9a
@ -61,29 +61,25 @@
|
||||
notify:
|
||||
- 'ensure_docker.package_facts'
|
||||
- 'ensure_docker.service_facts'
|
||||
- name: 'Fetch kernel command line'
|
||||
- name: 'Ensure cgroups are v1 only'
|
||||
when:
|
||||
- ansible_system == 'Linux'
|
||||
- ensure_docker is defined
|
||||
- ansible_distribution == 'Fedora'
|
||||
- ansible_distribution_major_version is version('32', '>=')
|
||||
shell: |
|
||||
cat /proc/cmdline
|
||||
register: 'results'
|
||||
changed_when: 'false'
|
||||
- name: 'Add cgroups v1 if disabled'
|
||||
when:
|
||||
- results is defined
|
||||
- results.stdout is defined
|
||||
- ' "systemd.unified_cgroup_hierarchy=0" not in results.stdout '
|
||||
- ansible_cmdline is defined
|
||||
- ansible_cmdline['systemd.unified_cgroup_hierarchy'] is not defined
|
||||
shell:
|
||||
cmd: |
|
||||
grubby --update-kernel=ALL --args=systemd.unified_cgroup_hierarchy=0
|
||||
- name: 'Reboot to enable cgroups v1'
|
||||
when:
|
||||
- results is defined
|
||||
- results.stdout is defined
|
||||
- ' "systemd.unified_cgroup_hierarchy=0" not in results.stdout '
|
||||
- ansible_system == 'Linux'
|
||||
- ensure_docker is defined
|
||||
- ansible_distribution == 'Fedora'
|
||||
- ansible_distribution_major_version is version('32', '>=')
|
||||
- ansible_cmdline is defined
|
||||
- ansible_cmdline['systemd.unified_cgroup_hierarchy'] is not defined
|
||||
reboot:
|
||||
- name: 'flush handlers'
|
||||
meta: 'flush_handlers'
|
||||
|
Loading…
x
Reference in New Issue
Block a user