Execution
Date 12 Sep 2025 07:57:36 +0100
Duration 00:00:04.40
Controller ssh-gw-4.layershift.com
User root
Versions
Ansible 2.16.11
ara 1.7.3 / 1.7.3
Python 3.10.10
Summary
15 Hosts
1 Tasks
15 Results
1 Plays
1 Files
0 Records

File: /home/ssh-gateway/ansible/kuly/free-mem-using-facts.yaml

---
- name: Retrieve and display total and free system memory in MB
  hosts: all
  gather_facts: true

  tasks:
    - name: Display total and free memory
      ansible.builtin.debug:
        msg: |
          System Memory Summary:
            Total Memory: {{ ansible_memtotal_mb }} MB
            Free Memory:  {{ ansible_memfree_mb }} MB
            Used Memory:  {{ ansible_memtotal_mb - ansible_memfree_mb }} MB
            Usage Ratio:  {{ "%.2f" | format((ansible_memtotal_mb - ansible_memfree_mb) * 100.0 / ansible_memtotal_mb) }}%