Oxs
(Oxs)
November 14, 2019, 3:39pm
1
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:
sivel
(sivel)
November 14, 2019, 3:53pm
2
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.
Oxs
(Oxs)
November 14, 2019, 4:15pm
3
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\