Flip logic on its head and check for existence only rather than content per contributor suggestion

This commit is contained in:
Daniel San Pedro
2024-02-29 22:31:06 -05:00
parent cd38ba51e3
commit f2bb1e35ae

View File

@@ -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'
)
}}