Created
June 21, 2016 17:06
-
-
Save jalons/650f9686e855221751a38f03c3d0b302 to your computer and use it in GitHub Desktop.
Get the members of a nodegroup, must be run from the master
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import salt.config | |
import salt.client | |
opts = salt.config.master_config('/etc/salt/master') | |
_client = salt.client.LocalClient() | |
_ret = {} | |
for _group, _target in opts.get('nodegroups').iteritems(): | |
_ret[_group] = _client.cmd(tgt=_target, fun='test.ping', expr_form='compound').keys() | |
print _ret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment