From f2bb1e35ae355df4d34f069ece3bee9e9ad4cf2e Mon Sep 17 00:00:00 2001 From: Daniel San Pedro Date: Thu, 29 Feb 2024 22:31:06 -0500 Subject: [PATCH] Flip logic on its head and check for existence only rather than content per contributor suggestion --- roles/raspberrypi/tasks/setup/Raspbian.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/roles/raspberrypi/tasks/setup/Raspbian.yml b/roles/raspberrypi/tasks/setup/Raspbian.yml index 76c4e66..0e32c2d 100644 --- a/roles/raspberrypi/tasks/setup/Raspbian.yml +++ b/roles/raspberrypi/tasks/setup/Raspbian.yml @@ -1,6 +1,7 @@ --- - name: Test for cmdline path - command: grep -E "console=|rootfstype" /boot/cmdline.txt + stat: + path: /boot/firmware/cmdline.txt register: boot_cmdline_path failed_when: false changed_when: false @@ -10,11 +11,11 @@ cmdline_path: >- {{ ( - boot_cmdline_path.rc == 0 and + boot_cmdline_path.stat.exists and ansible_facts.lsb.description | default('') is match('Debian.*(?!(bookworm|sid))') ) | ternary( - '/boot/cmdline.txt', - '/boot/firmware/cmdline.txt' + '/boot/firmware/cmdline.txt', + '/boot/cmdline.txt' ) }}