diff --git a/tasks/main.yml b/tasks/main.yml index b778e6f..a5a4afe 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -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'