From 60f7cbef9a0df1ffa34b822c4c82b0f5c01d38c6 Mon Sep 17 00:00:00 2001 From: mmagi Date: Tue, 9 Jul 2024 11:56:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=B8=BB=E6=9C=BA=E7=A1=AC=E4=BB=B6?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=A1=AC=E7=9B=98=E5=A4=A7=E5=B0=8F=E9=81=BF?= =?UTF-8?q?=E5=85=8D=E5=A4=9A=E6=AC=A1=E6=8C=82=E8=BD=BD=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E8=AE=A1=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/automations/gather_facts/host/posix/main.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/assets/automations/gather_facts/host/posix/main.yml b/apps/assets/automations/gather_facts/host/posix/main.yml index ba86d9a91..0b083c94b 100644 --- a/apps/assets/automations/gather_facts/host/posix/main.yml +++ b/apps/assets/automations/gather_facts/host/posix/main.yml @@ -12,7 +12,12 @@ cpu_cores: "{{ ansible_processor_cores }}" cpu_vcpus: "{{ ansible_processor_vcpus }}" memory: "{{ ansible_memtotal_mb / 1024 | round(2) }}" - disk_total: "{{ (ansible_mounts | map(attribute='size_total') | sum / 1024 / 1024 / 1024) | round(2) }}" + disk_total: |- + {% set ns = namespace(total=0) %} + {%- for name, dev in ansible_devices.items() if dev.removable == '0' and dev.host != '' -%} + {%- set ns.total = ns.total + ( dev.sectors | int * dev.sectorsize | int ) -%} + {%- endfor -%} + {{- (ns.total / 1024 / 1024 / 1024) | round(2) -}} distribution: "{{ ansible_distribution }}" distribution_version: "{{ ansible_distribution_version }}" arch: "{{ ansible_architecture }}"