Created
July 31, 2014 23:52
-
-
Save tystr/dadda60cc5ab1861a2e6 to your computer and use it in GitHub Desktop.
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
def get_hosts_for_role(role, puppetmaster="puppetmaster.mydomain.net"): | |
""" Query the puppetmaster for hosts of nodes whose server_role fact matches the given role """ | |
return yaml.load(local('ssh -T {0} \'curl -s -k -H "Accept: yaml" https://localhost:8140/production/facts_search/search?facts.server_role={1}\' | awk \'!/baseami/\''.format(puppetmaster, role), capture=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment