From a20e2cbf82623b915e048592edd087d552e03a66 Mon Sep 17 00:00:00 2001 From: Jason Rothstein Date: Mon, 8 Feb 2021 22:37:11 -0600 Subject: [PATCH] Use ansible_cmdline instead of cat for /proc/cmdline --- tasks/main.yml | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 87f5beb..d6ff678 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -67,23 +67,19 @@ - ensure_podman is defined - ansible_distribution == 'Fedora' - ansible_distribution_major_version is version('32', '>=') - shell: | - cat /proc/cmdline - register: 'results' - changed_when: 'false' -- name: 'Remove cgroups v1 if enabled' - when: - - results is defined - - results.stdout is defined - - ' "systemd.unified_cgroup_hierarchy=0" in results.stdout ' + - ansible_cmdline is defined + - ansible_cmdline['systemd.unified_cgroup_hierarchy'] is defined shell: cmd: | grubby --update-kernel=ALL --remove-args=systemd.unified_cgroup_hierarchy=0 - name: 'Reboot to disable cgroups v1' when: - - results is defined - - results.stdout is defined - - ' "systemd.unified_cgroup_hierarchy=0" in results.stdout ' + - ansible_system == 'Linux' + - ensure_podman is defined + - ansible_distribution == 'Fedora' + - ansible_distribution_major_version is version('32', '>=') + - ansible_cmdline is defined + - ansible_cmdline['systemd.unified_cgroup_hierarchy'] is defined reboot: - name: 'flush handlers' meta: 'flush_handlers'