diff --git a/templates/host.j2 b/templates/host.j2 index 9c05bf2..2921683 100644 --- a/templates/host.j2 +++ b/templates/host.j2 @@ -1,11 +1,12 @@ ====== {{ inventory_hostname }} ====== * FQDN: {{ ansible_fqdn }} -- {{ ansible_default_ipv4.address }} - * Product: **{{ ansible_system_vendor|default("N/A") }}** {{ ansible_product_name|default("N/A") }} (S/N: {{ ansible_product_serial }}), {{ ansible_form_factor }} + * Product: **{{ ansible_system_vendor|default("N/A") }}** {{ ansible_product_name|default("N/A") }} (S/N: {{ ansible_product_serial|default("N/A") }}), {{ ansible_form_factor|default("N/A") }} * Virtualization: {{ ansible_virtualization_role }} / {{ ansible_virtualization_type }} - * CPUs: {{ ansible_processor_vcpus }} ( {{ ansible_processor_count }} x {{ ansible_processor_cores }} Cores x {{ ansible_processor_threads_per_core }} Threads ) - * CPU-Type: {{ ansible_processor[2] }} - * RAM: {{ ansible_memtotal_mb }} MB - * Swap: {{ "%0.2f" % (ansible_swaptotal_mb / 1024) }} GB +{% if ansible_processor_vcpus|default(False) %} + * CPUs: {{ ansible_processor_vcpus }} ( {{ ansible_processor_count }} x {{ ansible_processor_cores }} Cores x {{ ansible_processor_threads_per_core }} Threads ){% endif %} + * CPU-Type: {{ ansible_processor[2]|default("N/A") }} + * RAM: {{ ansible_memtotal_mb|default("N/A") }} MB + * Swap: {{ "%0.2f" % (ansible_swaptotal_mb|default(0) / 1024) }} GB * OS: {{ ansible_distribution }} {{ ansible_distribution_version }} * Kernel: {{ ansible_kernel }} * Init: {{ ansible_service_mgr }} @@ -16,7 +17,7 @@ Mountpoints: | Source | Mountpoint | Filesystem | -{% for m in ansible_mounts %} +{% for m in ansible_mounts|default([]) %} | ''{{ m.device }}'' | ''{{ m.mount }}'' | ''{{ m.fstype }}'' | {% endfor %}