Add swap_enabled toggle for swap setup

This commit is contained in:
2026-01-02 18:51:27 +01:00
parent 2891de8fef
commit ce972e55dd
5 changed files with 146 additions and 48 deletions

View File

@@ -40,7 +40,9 @@
changed_when: false
- name: Make root subvolumes
when: cis_enabled or item.subvol not in ['var_log_audit']
when:
- cis_enabled or item.subvol not in ['var_log_audit']
- swap_enabled | bool or item.subvol != 'swap'
ansible.builtin.command: btrfs su cr /mnt/{{ '@' if item.subvol == 'root' else '@' + item.subvol }}
args:
creates: /mnt/{{ '@' if item.subvol == 'root' else '@' + item.subvol }}
@@ -63,6 +65,7 @@
changed_when: false
- name: Create a Btrfs swap file
when: swap_enabled | bool
ansible.builtin.command: >-
btrfs filesystem mkswapfile --size {{ partitioning_swap_size_gb }}g --uuid clear /mnt/@swap/swapfile
args: