fix 🐛: Update hostname tasks to include detailed information about the host's network configuration, memory usage, processor details, and mounted filesystems.
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.
This commit is contained in:
@@ -3,4 +3,43 @@
|
|||||||
tasks:
|
tasks:
|
||||||
- name: Show the local hostname
|
- name: Show the local hostname
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: "The hostname of this machine is {{ ansible_hostname }}"
|
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_<interface_name> is dynamic, so we iterate over the known interfaces
|
||||||
|
- name: Display details for each specific interface (ansible_<interface_name>)
|
||||||
|
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
|
||||||
Reference in New Issue
Block a user