Add zstd toggle for btrfs and zram

This commit is contained in:
2026-01-02 18:47:32 +01:00
parent 696df925c6
commit 2891de8fef
5 changed files with 30 additions and 16 deletions

View File

@@ -32,7 +32,7 @@
content: | content: |
[zram0] [zram0]
zram-size = ram / 2 zram-size = ram / 2
compression-algorithm = zstd compression-algorithm = {{ 'zstd' if zstd_enabled | bool else 'lz4' }}
swap-priority = 100 swap-priority = 100
fs-type = swap fs-type = swap
mode: "0644" mode: "0644"

View File

@@ -5,6 +5,7 @@ cis: false
selinux: true selinux: true
vmware_ssh: false vmware_ssh: false
firewalld_enabled: true firewalld_enabled: true
zstd_enabled: true
cis_enabled: "{{ cis | bool }}" cis_enabled: "{{ cis | bool }}"

View File

@@ -16,6 +16,7 @@ partitioning_luks_tpm2_device: "{{ luks_tpm2_device }}"
partitioning_luks_tpm2_pcrs: "{{ luks_tpm2_pcrs }}" partitioning_luks_tpm2_pcrs: "{{ luks_tpm2_pcrs }}"
partitioning_luks_keyfile_size: "{{ luks_keyfile_size }}" partitioning_luks_keyfile_size: "{{ luks_keyfile_size }}"
partitioning_luks_options: "{{ luks_options }}" partitioning_luks_options: "{{ luks_options }}"
partitioning_btrfs_compress_opt: "{{ 'compress=zstd:15' if zstd_enabled | bool else '' }}"
partitioning_boot_partition_suffix: 1 partitioning_boot_partition_suffix: 1
partitioning_main_partition_suffix: 2 partitioning_main_partition_suffix: 2
partitioning_efi_size_mib: 512 partitioning_efi_size_mib: 512

View File

@@ -19,7 +19,19 @@
path: /mnt path: /mnt
src: "{{ partitioning_root_device }}" src: "{{ partitioning_root_device }}"
fstype: btrfs fstype: btrfs
opts: rw,relatime,compress=zstd:15,ssd,space_cache=v2,discard=async opts: >-
{{
[
'rw',
'relatime',
partitioning_btrfs_compress_opt,
'ssd',
'space_cache=v2',
'discard=async'
]
| reject('equalto', '')
| join(',')
}}
state: mounted state: mounted
- name: Enable quotas on Btrfs filesystem - name: Enable quotas on Btrfs filesystem

View File

@@ -474,17 +474,17 @@
'defaults' 'defaults'
if filesystem != 'btrfs' if filesystem != 'btrfs'
else [ else [
'rw', 'relatime', 'compress=zstd:15', 'ssd', 'space_cache=v2', 'rw', 'relatime', partitioning_btrfs_compress_opt, 'ssd', 'space_cache=v2',
'discard=async', 'subvol=@' 'discard=async', 'subvol=@'
] | join(',') ] | reject('equalto', '') | join(',')
}} }}
- path: /swap - path: /swap
opts: >- opts: >-
{{ {{
[ [
'rw', 'nosuid', 'nodev', 'relatime', 'compress=zstd:15', 'ssd', 'rw', 'nosuid', 'nodev', 'relatime', partitioning_btrfs_compress_opt, 'ssd',
'space_cache=v2', 'discard=async', 'subvol=@swap' 'space_cache=v2', 'discard=async', 'subvol=@swap'
] | join(',') ] | reject('equalto', '') | join(',')
}} }}
- path: /home - path: /home
uuid: "{{ partitioning_uuid_home[0] | default(omit) }}" uuid: "{{ partitioning_uuid_home[0] | default(omit) }}"
@@ -493,9 +493,9 @@
'defaults,nosuid,nodev' 'defaults,nosuid,nodev'
if filesystem != 'btrfs' if filesystem != 'btrfs'
else [ else [
'rw', 'nosuid', 'nodev', 'relatime', 'compress=zstd:15', 'ssd', 'rw', 'nosuid', 'nodev', 'relatime', partitioning_btrfs_compress_opt, 'ssd',
'space_cache=v2', 'discard=async', 'subvol=@home' 'space_cache=v2', 'discard=async', 'subvol=@home'
] | join(',') ] | reject('equalto', '') | join(',')
}} }}
- path: /var - path: /var
uuid: "{{ partitioning_uuid_var[0] | default(omit) }}" uuid: "{{ partitioning_uuid_var[0] | default(omit) }}"
@@ -504,9 +504,9 @@
'defaults,nosuid,nodev' 'defaults,nosuid,nodev'
if filesystem != 'btrfs' if filesystem != 'btrfs'
else [ else [
'rw', 'nosuid', 'nodev', 'relatime', 'compress=zstd:15', 'ssd', 'rw', 'nosuid', 'nodev', 'relatime', partitioning_btrfs_compress_opt, 'ssd',
'space_cache=v2', 'discard=async', 'subvol=@var' 'space_cache=v2', 'discard=async', 'subvol=@var'
] | join(',') ] | reject('equalto', '') | join(',')
}} }}
- path: /var/log - path: /var/log
uuid: "{{ partitioning_uuid_var_log[0] | default(omit) }}" uuid: "{{ partitioning_uuid_var_log[0] | default(omit) }}"
@@ -515,9 +515,9 @@
'defaults,nosuid,nodev,noexec' 'defaults,nosuid,nodev,noexec'
if filesystem != 'btrfs' if filesystem != 'btrfs'
else [ else [
'rw', 'nosuid', 'nodev', 'noexec', 'relatime', 'compress=zstd:15', 'rw', 'nosuid', 'nodev', 'noexec', 'relatime', partitioning_btrfs_compress_opt,
'ssd', 'space_cache=v2', 'discard=async', 'subvol=@var_log' 'ssd', 'space_cache=v2', 'discard=async', 'subvol=@var_log'
] | join(',') ] | reject('equalto', '') | join(',')
}} }}
- path: /var/cache/pacman/pkg - path: /var/cache/pacman/pkg
uuid: "{{ partitioning_uuid_root | default([]) | first | default(omit) }}" uuid: "{{ partitioning_uuid_root | default([]) | first | default(omit) }}"
@@ -526,9 +526,9 @@
'defaults,nosuid,nodev,noexec' 'defaults,nosuid,nodev,noexec'
if filesystem != 'btrfs' if filesystem != 'btrfs'
else [ else [
'rw', 'nosuid', 'nodev', 'noexec', 'relatime', 'compress=zstd:15', 'rw', 'nosuid', 'nodev', 'noexec', 'relatime', partitioning_btrfs_compress_opt,
'ssd', 'space_cache=v2', 'discard=async', 'subvol=@pkg' 'ssd', 'space_cache=v2', 'discard=async', 'subvol=@pkg'
] | join(',') ] | reject('equalto', '') | join(',')
}} }}
- path: /var/log/audit - path: /var/log/audit
uuid: "{{ partitioning_uuid_var_log_audit[0] | default(omit) }}" uuid: "{{ partitioning_uuid_var_log_audit[0] | default(omit) }}"
@@ -537,9 +537,9 @@
'defaults,nosuid,nodev,noexec' 'defaults,nosuid,nodev,noexec'
if filesystem != 'btrfs' if filesystem != 'btrfs'
else [ else [
'rw', 'nosuid', 'nodev', 'noexec', 'relatime', 'compress=zstd:15', 'rw', 'nosuid', 'nodev', 'noexec', 'relatime', partitioning_btrfs_compress_opt,
'ssd', 'space_cache=v2', 'discard=async', 'subvol=@var_log_audit' 'ssd', 'space_cache=v2', 'discard=async', 'subvol=@var_log_audit'
] | join(',') ] | reject('equalto', '') | join(',')
}} }}
- name: Mount /boot filesystem - name: Mount /boot filesystem