improve logical volume size calculation

This commit is contained in:
Sandwich 2024-10-31 17:32:27 +01:00
parent f83a9ebd67
commit c9a15dfccf
2 changed files with 37 additions and 16 deletions

View File

@ -1,11 +1,4 @@
--- ---
- name: Unmount /mnt recursively
when: os not in ['rhel8', 'rhel9']
become: false
ansible.builtin.command: umount -l /mnt
changed_when: result.rc == 0
register: result
- name: Setup Cleanup - name: Setup Cleanup
when: hypervisor == "proxmox" when: hypervisor == "proxmox"
delegate_to: localhost delegate_to: localhost

View File

@ -43,15 +43,43 @@
size: "{{ item.size }}" size: "{{ item.size }}"
state: present state: present
loop: loop:
- { lv: root, size: "{{ [(vm_size | float) - 0.5 - (((vm_memory | float / 1024) >= 16.0) - lv: root
| ternary((vm_memory | float / 1024 / 2) | int, 4)) - 7.5, 1] | max | float size: >-
| round(1) | string + 'G' }}" } {{ ((cis | lower == 'true') | ternary(
- { lv: swap, size: "{{ ((vm_memory | float / 1024 >= 16.0) | ternary((vm_memory | float / 2048) (((vm_size | float - ((vm_memory | float / 1024 >= 16.0) | ternary(
| int, [vm_memory | float / 1024, 4.0] | max)) | string + 'G' }}" } (vm_memory | float / 2048) | int,
- { lv: home, size: "2G" } [vm_memory | float / 1024, 4.0] | max
- { lv: var, size: "2G" } )) - 0.5 - 7.5) > 12.0) | ternary(
- { lv: var_log, size: "2G" } (vm_size | float * 0.4) | round(0, 'ceil'),
- { lv: var_log_audit, size: "1.5G" } vm_size | float - ((vm_memory | float / 1024 >= 16.0) | ternary(
(vm_memory | float / 2048) | int,
[vm_memory | float / 1024, 4.0] | max
)) - 0.5 - 7.5
)),
vm_size | float - ((vm_memory | float / 1024 >= 16.0) | ternary(
(vm_memory | float / 2048) | int,
[vm_memory | float / 1024, 4.0] | max
)) - 0.5
)) | string + 'G' }}
- lv: swap
size: >-
{{ ((vm_memory | float / 1024 >= 16.0) | ternary(
(vm_memory | float / 2048) | int,
[vm_memory | float / 1024, 4.0] | max
)) | string + 'G' }}
- lv: home
size: "2G"
- lv: var
size: "2G"
- lv: var_log
size: "2G"
- lv: var_log_audit
size: "1.5G"
- name: Create filesystems - name: Create filesystems
block: block: