From 71a7c92d83ba783355ec4efbb45db03704205f5e Mon Sep 17 00:00:00 2001 From: Jose Date: Sun, 12 Oct 2025 07:45:44 +0200 Subject: [PATCH] =?UTF-8?q?fix=20=F0=9F=90=9B:=20Update=20the=20`hostname.?= =?UTF-8?q?yml`=20playbook=20to=20display=20a=20summary=20of=20mounted=20f?= =?UTF-8?q?ilesystems=20safely,=20excluding=20tmpfs,=20overlay,=20and=20sq?= =?UTF-8?q?uashfs=20file=20systems.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes the `hostname.yml` playbook to provide a more detailed and safe view of mounted filesystems by excluding certain types. --- tasks/hostname.yml | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/tasks/hostname.yml b/tasks/hostname.yml index 0cfcabd..102a00f 100644 --- a/tasks/hostname.yml +++ b/tasks/hostname.yml @@ -20,7 +20,7 @@ {% for cpu in ansible_processor %} - {{ cpu }} {% endfor %} - + # ---------------------------------------------------------------------- # 2. NETWORK INFORMATION # ---------------------------------------------------------------------- @@ -48,16 +48,23 @@ # ---------------------------------------------------------------------- # 3. STORAGE INFORMATION # ---------------------------------------------------------------------- - - name: Show Mounted Filesystems + - name: Display Mounted Filesystems Summary (Safely) ansible.builtin.debug: msg: | - Mounted Filesystems: - {% for mount in ansible_mounts %} - - Mount Point : {{ mount.mount }} - Device : {{ mount.device }} - Fstype : {{ mount.fstype }} - Size Total : {{ mount.size_total | int // (1024*1024) }} MB - Size Used : {{ mount.size_used | int // (1024*1024) }} MB + 💾 Mounted Filesystems + ------------------------- + {% for mount in ansible_mounts and mount.fstype not in ['tmpfs', 'overlay', 'squashfs']%} + Mount Point : {{ mount.mount }} + Device : {{ mount.device }} + Fstype : {{ mount.fstype }} + {% if 'size_used' in mount and 'size_total' in mount and mount.fstype not in ['tmpfs', 'overlay', 'squashfs']%} + Size Total : {{ (mount.size_total | int // (1024 * 1024)) }} MB + Size Used : {{ (mount.size_used | int // (1024 * 1024)) }} MB + Size Avail : {{ ((mount.size_total | int - mount.size_used | int) // (1024 * 1024)) }} MB + {% else %} + Size Info : Not Available + {% endif %} + ------------------------- {% endfor %} # ----------------------------------------------------------------------