From b789c705d851eb8871b28d5c428b22c1196a3883 Mon Sep 17 00:00:00 2001 From: Jose Date: Sun, 12 Oct 2025 07:32:02 +0200 Subject: [PATCH] =?UTF-8?q?fix=20=F0=9F=90=9B:=20Update=20hostname=20tasks?= =?UTF-8?q?=20to=20include=20detailed=20information=20about=20the=20host's?= =?UTF-8?q?=20network=20configuration,=20memory=20usage,=20processor=20det?= =?UTF-8?q?ails,=20and=20mounted=20filesystems.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit updates the `hostname.yml` playbook to provide comprehensive details about the host's network configuration, memory usage, processor details, and mounted filesystems. The changes include adding new tasks to display these details for each specific interface. --- tasks/hostname.yml | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/tasks/hostname.yml b/tasks/hostname.yml index bc09951..2f5e865 100644 --- a/tasks/hostname.yml +++ b/tasks/hostname.yml @@ -3,4 +3,43 @@ tasks: - name: Show the local hostname ansible.builtin.debug: - msg: "The hostname of this machine is {{ ansible_hostname }}" \ No newline at end of file + msg: "The hostname of this machine is {{ ansible_hostname }}" + + - name: Display Host FQDN + ansible.builtin.debug: + msg: "ansible_fqdn: {{ ansible_fqdn }}" + + - name: Display OS Family + ansible.builtin.debug: + msg: "ansible_os_family: {{ ansible_os_family }}" + + - name: Display Architecture + ansible.builtin.debug: + msg: "ansible_architecture: {{ ansible_architecture }}" + + - name: Display Default IPv4 Information + ansible.builtin.debug: + msg: "ansible_default_ipv4: {{ ansible_default_ipv4 }}" + + - name: Display All Interfaces + ansible.builtin.debug: + msg: "ansible_interfaces: {{ ansible_interfaces }}" + + - name: Display Memory Total (MB) + ansible.builtin.debug: + msg: "ansible_memtotal_mb: {{ ansible_memtotal_mb }}" + + - name: Display Processor Information + ansible.builtin.debug: + msg: "ansible_processor: {{ ansible_processor }}" + + - name: Display Mounted Filesystems + ansible.builtin.debug: + msg: "ansible_mounts: {{ ansible_mounts }}" + + # The fact ansible_ is dynamic, so we iterate over the known interfaces + - name: Display details for each specific interface (ansible_) + ansible.builtin.debug: + var: hostvars['localhost']['ansible_' + item] + loop: "{{ ansible_interfaces }}" + when: hostvars['localhost']['ansible_' + item] is defined and item not in ['lo'] # Exclude 'lo' (loopback) for cleaner output \ No newline at end of file