how to group results by value

14 views
Skip to first unread message

Heiner W

unread,
Sep 21, 2022, 2:34:09 PMSep 21
to Salt-users
Hi List!

i usually check if all my systems are configured equally before modifying any config on those systems. Or sometimes i find a system with wrong config and need to know if/which other systems are also affected.

Is there a clever way of comparing the results of salt commands given to multiple clients?

e.G.:
If i execute # salt multipleclients*  grains.get virtual on master i would like salt to group results by values (in our case one group for "physical" and one for "VMware").

BR
Heiner

Phipps, Thomas

unread,
Sep 21, 2022, 2:38:08 PMSep 21
to salt-...@googlegroups.com

hey there. there is a nifty runner that can be used for this.

https://docs.saltproject.io/en/latest/ref/runners/all/salt.runners.survey.html

here is an example output

root@salt00:~# salt-run survey.hash \* grains.get pythonversion
|_
  ----------
  pool:
      - dbz.novalocal
      - devbox.novalocal
      - ipa.wolfnet.bad4.us
      - media.wolfnet.bad4.us
      - zabbix.novalocal
  result:
      [3, 6, 8, 'final', 0]
|_
  ----------
  pool:
      - amity
  result:
      [3, 8, 13, 'final', 0]
|_
  ----------
  pool:
      - home.wolfnet.bad4.us
  result:
      [3, 9, 2, 'final', 0]
|_
  ----------
  pool:
      - salt00
  result:
      [3, 10, 4, 'final', 0]

--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/salt-users/014120d7-4790-443b-8af3-a83f21c4bec1n%40googlegroups.com.

Heiner W

unread,
Sep 22, 2022, 3:35:30 AMSep 22
to Salt-users
Hi Thomas,

thanks a lot, you made my day! This is exactly what i was looking for!

Best Regards,
Heiner
Reply all
Reply to author
Forward
0 new messages