From 2c4995ede851247aa1227138f5e4b0f872f5f472 Mon Sep 17 00:00:00 2001 From: Sandwich Date: Thu, 31 Oct 2024 01:29:48 +0100 Subject: [PATCH] Make root LV size dynamic based on VM disk size --- roles/partitioning/tasks/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/partitioning/tasks/main.yml b/roles/partitioning/tasks/main.yml index 06d038e..8aa262e 100644 --- a/roles/partitioning/tasks/main.yml +++ b/roles/partitioning/tasks/main.yml @@ -43,7 +43,8 @@ size: "{{ item.size }}" state: present loop: - - { lv: root, size: 12G } + - { lv: root, size: "{{ '12G' if (vm_size | int * 0.4) < 12 + else (vm_size | int * 0.4) | round(0, 'ceil') | int | string + 'G' }}" } - { lv: home, size: 2G } - { lv: var, size: 2G } - { lv: var_log, size: 2G }