30 lines
No EOL
893 B
YAML
30 lines
No EOL
893 B
YAML
- hosts: all
|
|
gather_facts: true
|
|
|
|
tasks:
|
|
- name: Display Hostname
|
|
debug:
|
|
msg: "Hostname: {{ ansible_hostname }}"
|
|
|
|
- name: Display Operating System
|
|
debug:
|
|
msg: "Operating System: {{ ansible_distribution }} {{ ansible_distribution_version }}"
|
|
|
|
- name: Check CPU and total memory
|
|
debug:
|
|
msg: "CPU Architecture: {{ ansible_architecture }}, Total Memory: {{ ansible_memtotal_mb }} MB"
|
|
|
|
- name: Check network interface information
|
|
debug:
|
|
msg: "IP Address is {{ ansible_default_ipv4.address }}"
|
|
|
|
- name: Get disk space info for /
|
|
set_fact:
|
|
root_space_info: "{{ item }}"
|
|
loop: "{{ ansible_mounts }}"
|
|
when: item.mount == "/"
|
|
|
|
- name: Display disk space information
|
|
debug:
|
|
msg: "Free space on /: {{ (root_space_info.size_available / 1024**3) | round(2) }} GB"
|
|
when: root_space_info is defined |