# debug vars

**URL:** <https://forum.ansible.com/t/debug-vars/31661>\
**Category:** Ansible Project\
**Tags:** rhel\
**Created:** [November 14, 2019, 3:39pm UTC](https://forum.ansible.com/t/debug-vars/31661 "2019-11-14T15:39:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oxs](https://avatars.discourse-cdn.com/v4/letter/o/ebca7d/32.png) [@Oxs](https://forum.ansible.com/u/Oxs)\
**Post date:** [November 14, 2019, 3:39pm UTC](https://forum.ansible.com/t/debug-vars/31661/1 "2019-11-14T15:39:36Z")

</div>

Dear all,

I would like to have the nRam and nCPU of this following output.  
How I can sort this output with a var?

The following content of my result:

- debug:  
var: result.content

ok: [localhost] =\> {  
“result.content”: "

```
\nId: 19171\nNom: LAB-001\nType: virtuel\nOS: Linux RHEL 7.5\nEnvironnement: Lab\nEtat: En service\nNom parent: LAB\nType parent: cluster\nFonction: Inconnue\nNo CTI: *_nRAM_*: 8192*_nCPU_*: 2\nCORE:
```

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [November 14, 2019, 3:53pm UTC](https://forum.ansible.com/t/debug-vars/31661/2 "2019-11-14T15:53:40Z")

</div>

Something like this would probably work:

‘{{ result.content|regex\_findall(“(?m)^(?:RAM|CPU):\s+(\d+)”) }}’

That returns something like:

ok: [localhost] =\> {  
“msg”: [  
“8192”,  
“2”  
]  
}

If the result is unordered, you might need to remove the ?: before RAM, so that is included in the match as well, so you can rely on that instead of implicit order.

---

<div class="post-metadata">

**Author:** ![Oxs](https://avatars.discourse-cdn.com/v4/letter/o/ebca7d/32.png) [@Oxs](https://forum.ansible.com/u/Oxs)\
**Post date:** [November 14, 2019, 4:15pm UTC](https://forum.ansible.com/t/debug-vars/31661/3 "2019-11-14T16:15:04Z")

</div>

Thanks a lot you rocks! How I can learn about this output?  
Yes it’s better when I removed the ?:

It’s the same structure of this command if I want the nSite and the nSalle output?

“content”: "

```
\nId: 47\nNom: THONON11\nType: virtuel\nOS: AIX 7200-03-03\nEnvironnement: Production\nEtat: En service\nNom parent: G1S824\nType parent: serveur physique\nFonction: Gestion documentaire (GED)\nNo CTI: \nRAM: 3072\nCPU: \nCORE: \nRéseau: GOLDAPPLIMETIER-AEL\nRemarque: Docubase DIS metier2 Admin\nAdresse IP: \nMarque: \nModèle: \nType CPU: *_nSite_*: DC2*_nSalle_*: Salle02\nRack: 301\
```
