The commit message is concise and descriptive, adhering to the specified rules. It also provides an extended summary that describes the changes in more detail for the commit description.
88 lines
3.3 KiB
YAML
88 lines
3.3 KiB
YAML
- hosts: localhost
|
|
gather_facts: yes
|
|
tasks:
|
|
|
|
# ----------------------------------------------------------------------
|
|
# 1. SYSTEM INFORMATION SUMMARY
|
|
# ----------------------------------------------------------------------
|
|
- name: Display Grouped System Information
|
|
ansible.builtin.debug:
|
|
msg: |
|
|
🖥️ System Information
|
|
-------------------------
|
|
Hostname : {{ ansible_hostname }}
|
|
FQDN : {{ ansible_fqdn }}
|
|
OS Family : {{ ansible_os_family }}
|
|
Architecture : {{ ansible_architecture }}
|
|
Total Memory : {{ ansible_memtotal_mb }} MB
|
|
|
|
Processor(s):
|
|
{% for cpu in ansible_processor %}
|
|
- {{ cpu }}
|
|
{% endfor %}
|
|
|
|
# ----------------------------------------------------------------------
|
|
# 2. NETWORK INFORMATION
|
|
# ----------------------------------------------------------------------
|
|
- name: Show Default IPv4 Info
|
|
ansible.builtin.debug:
|
|
msg: |
|
|
Default IPv4 Info:
|
|
Address : {{ ansible_default_ipv4.address }}
|
|
Interface : {{ ansible_default_ipv4.interface }}
|
|
Gateway : {{ ansible_default_ipv4.gateway }}
|
|
Netmask : {{ ansible_default_ipv4.netmask }}
|
|
|
|
- name: Show All Network Interfaces
|
|
ansible.builtin.debug:
|
|
msg: |
|
|
Network Interfaces:
|
|
{{ ansible_interfaces | join('\n - ') }}
|
|
|
|
- name: Show Details for Each Interface (Excluding Loopback)
|
|
ansible.builtin.debug:
|
|
var: hostvars['localhost']['ansible_' + item]
|
|
loop: "{{ ansible_interfaces }}"
|
|
when: hostvars['localhost']['ansible_' + item] is defined and item not in ['lo']
|
|
|
|
# ----------------------------------------------------------------------
|
|
# 3. STORAGE INFORMATION
|
|
# ----------------------------------------------------------------------
|
|
- name: Show Mounted Filesystems
|
|
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
|
|
{% endfor %}
|
|
|
|
# ----------------------------------------------------------------------
|
|
# 4. CURRENT USER DETAILS
|
|
# ----------------------------------------------------------------------
|
|
- name: Show Connection and Effective User Details
|
|
ansible.builtin.debug:
|
|
msg: |
|
|
Current SSH User : {{ ansible_user }}
|
|
Effective Task User ID : {{ ansible_user_id }}
|
|
Effective User Shell : {{ ansible_user_shell }}
|
|
Effective User Home Dir : {{ ansible_user_dir }}
|
|
|
|
# ----------------------------------------------------------------------
|
|
# 5. ALL SYSTEM USERS
|
|
# ----------------------------------------------------------------------
|
|
- name: Gather All Users (/etc/passwd)
|
|
ansible.builtin.getent:
|
|
database: passwd
|
|
|
|
- name: Show All Usernames
|
|
ansible.builtin.debug:
|
|
msg: |
|
|
System Users:
|
|
{% for u in getent_passwd | dict2items %}
|
|
- {{ u.key }}
|
|
{% endfor %}
|