Ansible-Bootstrap/roles/partitioning/tasks/btrfs.yml

43 lines
1.3 KiB
YAML
Raw Normal View History

2024-03-19 23:02:50 +01:00
---
- name: Setup BTRFS
block:
- name: Create btrfs filesystem in main volume
filesystem:
dev: '{{ install_drive }}{{ main_partition_suffix }}'
fstype: btrfs
2024-07-11 22:09:58 +02:00
force: true
2024-03-19 23:02:50 +01:00
- name: Prepare BTRFS Subvolume
mount:
path: /mnt
src: '{{ install_drive }}{{ main_partition_suffix }}'
fstype: btrfs
opts: rw,relatime,compress=zstd:15,ssd,space_cache=v2,discard=async
state: mounted
- name: Enable quotas on Btrfs filesystem
command: btrfs quota enable /mnt
- name: Make root subvolumes
when: cis == true or item.subvol not in ['var_log', 'var_log_audit']
command: btrfs su cr /mnt/{{ '@' if item.subvol == 'root' else '@' + item.subvol }}
loop:
- { subvol: root }
- { subvol: home }
- { subvol: var }
- { subvol: var_log }
- { subvol: var_log_audit }
- name: Set quotas for subvolumes
when: cis == true or item.subvol not in ['var_log', 'var_log_audit']
command: btrfs qgroup limit {{ item.quota }} /mnt/{{ '@' if item.subvol == 'root' else '@' + item.subvol }}
loop:
- { subvol: home, quota: '2G' }
- name: Unmount Partition
mount:
path: /mnt
src: '{{ install_drive }}{{ main_partition_suffix }}'
fstype: btrfs
2024-05-21 14:20:28 +02:00
state: unmounted