Files
ansible_samba_tasks/tasks/hostname.yml

45 lines
1.6 KiB
YAML
Raw Normal View History

- hosts: localhost
gather_facts: yes
tasks:
- name: Show the local hostname
ansible.builtin.debug:
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