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