Skip to content

Instantly share code, notes, and snippets.

@cybacolt
Last active January 20, 2016 05:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cybacolt/b1bd98534c155ee582a8 to your computer and use it in GitHub Desktop.
Save cybacolt/b1bd98534c155ee582a8 to your computer and use it in GitHub Desktop.
1) make sure mine_interval is set in your minion config
2) add mine functions to your minions pillars:
mine_functions:
grains.items: []
3) wait until this returns data on your salt master:
salt '*' mine.get '*' grains.items
4) mine data from minions is now available in states like this:
salt['mine.get']('myminion*', 'grains.items')
5) mine data from minions is now available in pillars like this:
salt['saltutil.runner']('mine.get', tgt='myminion*', fun='grains.items', tgt_type='compound')
6) if there are multiple minions returned, you'll need to do a for loop over it:
{% for host, grains in salt['mine.get']('myminion*', 'grains.items').items() %}
7) if you have a minion than requires alot of mine data, and you start to have timeout problems when you run state.highstate, this was my work around:
https://github.com/saltstack/salt/issues/21403#issuecomment-172723015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment