diff --git a/roles/partitioning/tasks/btrfs.yml b/roles/partitioning/tasks/btrfs.yml index 84f367a..edd01b5 100644 --- a/roles/partitioning/tasks/btrfs.yml +++ b/roles/partitioning/tasks/btrfs.yml @@ -19,7 +19,7 @@ ansible.builtin.command: btrfs quota enable /mnt - name: Make root subvolumes - when: cis == true or item.subvol not in ['var_log', 'var_log_audit'] + when: cis | bool or item.subvol not in ['var_log', 'var_log_audit'] ansible.builtin.command: btrfs su cr /mnt/{{ '@' if item.subvol == 'root' else '@' + item.subvol }} loop: - { subvol: root } @@ -29,7 +29,7 @@ - { subvol: var_log_audit } - name: Set quotas for subvolumes - when: cis == true or item.subvol not in ['var_log', 'var_log_audit'] + when: cis | bool or item.subvol not in ['var_log', 'var_log_audit'] ansible.builtin.command: btrfs qgroup limit {{ item.quota }} /mnt/{{ '@' if item.subvol == 'root' else '@' + item.subvol }} loop: - { subvol: home, quota: 2G } diff --git a/roles/partitioning/tasks/ext4.yml b/roles/partitioning/tasks/ext4.yml index ecb814d..fc37ddb 100644 --- a/roles/partitioning/tasks/ext4.yml +++ b/roles/partitioning/tasks/ext4.yml @@ -1,6 +1,6 @@ --- - name: Create and format ext4 logical volumes - when: cis == true or item.lv not in ['var_log', 'var_log_audit'] + when: cis | bool or item.lv not in ['var_log', 'var_log_audit'] community.general.filesystem: dev: /dev/sys/{{ item.lv }} fstype: ext4 @@ -13,7 +13,7 @@ - { lv: var_log_audit } - name: Remove Unsupported features for older Systems - when: (os | lower in ['almalinux', 'debian11', 'rhel8', 'rhel9', 'rocky', 'ubuntu-lts']) and (cis == true or item.lv not in ['var_log', 'var_log_audit']) + when: (os | lower in ['almalinux', 'debian11', 'rhel8', 'rhel9', 'rocky', 'ubuntu-lts']) and (cis | bool or item.lv not in ['var_log', 'var_log_audit']) ansible.builtin.command: tune2fs -O "^orphan_file,^metadata_csum_seed" "/dev/sys/{{ item.lv }}" loop: - { lv: root } diff --git a/roles/partitioning/tasks/main.yml b/roles/partitioning/tasks/main.yml index b3e1b71..0a3c19b 100644 --- a/roles/partitioning/tasks/main.yml +++ b/roles/partitioning/tasks/main.yml @@ -70,7 +70,7 @@ register: main_uuid - name: Get UUIDs for LVM filesystems - when: filesystem != 'btrfs' and (cis == true or item not in ['var_log', 'var_log_audit']) + when: filesystem != 'btrfs' and (cis | bool or item not in ['var_log', 'var_log_audit']) ansible.builtin.command: blkid -s UUID -o value /dev/sys/{{ item }} changed_when: false register: uuid_result @@ -93,7 +93,7 @@ - name: Mount filesystems block: - name: Mount filesystems and subvolumes - when: cis or (not cis and item.path != '/var/log' and item.path != '/var/log/audit') + when: cis | bool or (not cis and item.path != '/var/log' and item.path != '/var/log/audit') ansible.posix.mount: path: /mnt{{ item.path }} src: "{{ 'UUID=' + (main_uuid.stdout if filesystem == 'btrfs' else item.uuid) }}" diff --git a/roles/partitioning/tasks/xfs.yml b/roles/partitioning/tasks/xfs.yml index 08f997e..b4f29b5 100644 --- a/roles/partitioning/tasks/xfs.yml +++ b/roles/partitioning/tasks/xfs.yml @@ -1,6 +1,6 @@ --- - name: Create and format XFS logical volumes - when: cis == true or item.lv not in ['var_log', 'var_log_audit'] + when: cis | bool or item.lv not in ['var_log', 'var_log_audit'] community.general.filesystem: dev: /dev/sys/{{ item.lv }} fstype: xfs