Created
February 4, 2014 04:21
-
-
Save jfrost/8798108 to your computer and use it in GitHub Desktop.
Basic Saltstack mine.get example
This file contains hidden or 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
# This jinja template will demonstrate what grains are available from other nodes via salt's mine.get function | |
{% for host, data in salt['mine.get']('*', 'grains.items', expr_form = 'glob').items() -%} | |
{% for key, value in data.items() -%} | |
{{ host }} - {{ key }}: {{ value }} | |
{% endfor -%} | |
{% endfor -%} |
hi jfrost, thanks for your snippet and it is useful. In my project, people are using mine.get as,
{% set remote = [] %}
{% for server, ipaddrs in salt['mine.get']('kroles:remote', 'network.ip_addrs', 'grain').items() %}
{% do remote.append(server) %}
{% endfor %}
{% set lanforge = [] %}
{% for server, ipaddrs in salt['mine.get']('lg*', 'network.ip_addrs', 'glob').items() %}
{% do lanforge.append(server) %}
{% endfor %}
what is the third argument, ('glob', 'grain') that is used in my project? i am not seeing the argument in your snippet...
is it possible to have a simple example of mine for getting ip address for all appserver group. I try you example and i need more information
thank
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
/tmp/saltmine-example.txt:
file.managed:
- source: salt://saltmine-example/saltmine-example.jinja
- template: jinja
- user: root
- group: root