Skip to content

Instantly share code, notes, and snippets.

@hemebond
Created March 18, 2021 14:25
Show Gist options
  • Save hemebond/7961da299ac3fd17e168d1666d411a54 to your computer and use it in GitHub Desktop.
Save hemebond/7961da299ac3fd17e168d1666d411a54 to your computer and use it in GitHub Desktop.
Using Grains cache in pillars
{%- set grns = salt.saltutil.runner('cache.grains', tgt='serv*') %}
{%- for id, grn in grns.items()|sort %}
{%- set role = id[3:6] %}
address: {{ grn.ip4_interfaces.eth0[0] | default("127.0.0.1") }}
{%- endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment