Hi, All!
My code:

- name: ===== Блок отримання інформації про виділену RAM 
==========================================
  block:
    - name: ===== Вівід інформації про виділену, використану та залишок 
пам'яті ===================
      ansible.builtin.debug:
        msg: "Виділена пам'ять: {{ ansible_memory_mb.real.total }} | 
Використана: {{ ansible_memory_mb.real.used }} | Залишилось: {{ 
ansible_memory_mb.real.total - ansible_memory_mb.real.used }} ({{ 
((1-ansible_memory_mb.real.used/ansible_memory_mb.real.total)*100)|int }}%)"

*stdout:*
ok: *[vl-nr-app1]* => {
    "msg": "Виділена пам'ять: *2619* | Використана: *2004* | Залишилось: 
*615* (23%)"
}
ok: *[vl-nr-app2] *=> {
    "msg": "Виділена пам'ять: *2619* | Використана: *1983* | Залишилось: 
*636* (24%)"
}
ok: *[al-nr-app1] *=> {
    "msg": "Виділена пам'ять: *2619* | Використана: *2073* | Залишилось: 546 
(*20%)*"
}

вторник, 8 февраля 2022 г. в 19:16:40 UTC+2, Rilindo Foster: 

> Hi Dip!
>
> Assuming that you are referring to this code, note that that Ansible will 
> run python on the target node - Python the interpreter itself will consume 
> memory. And then if you run the shell module under Ansible, it will spawn a 
> shell which itself will consume memory as well.
>
> - Rilindo
>
> On Feb 8, 2022, at 8:46 AM, Dip Giri <[email protected]> wrote:
>
> Whatever ansible give a memory info in ansible_fact it doesn't match with 
> memory info 
> that we get from *free -m *command. Why this problem happened for that if 
> have any solution plz give me 
>
> ---
> - name: Setup server
> hosts: localhost
> tasks:
>
> - name: test
> shell: free -m
> register: xyz
>
> - name: Print service status
> debug:
> msg: "{{ansible_memory_mb.real}}"
>
> - name: Print service status
> debug:
> msg: "{{xyz.stdout.split('\n')}}"
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/74109954-cb3c-4b72-a5b0-34f9e425f16fn%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/ansible-project/74109954-cb3c-4b72-a5b0-34f9e425f16fn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b7cd7e24-5e0a-4e14-a6a0-886db68269e4n%40googlegroups.com.

Reply via email to