Skip to content

Instantly share code, notes, and snippets.

@tuaris
Created November 10, 2021 04:19
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 tuaris/b1659f02e3d233723edeac60bb8b6879 to your computer and use it in GitHub Desktop.
Save tuaris/b1659f02e3d233723edeac60bb8b6879 to your computer and use it in GitHub Desktop.
Saltstack Multiple roles
# Pillar Data
root@master:~# salt 'monitor.*' pillar.items
monitor.prod.domain.tld:
----------
role:
- collector
- metabase
- grafana
- prometheus
# Trying to Target
salt -I 'role:collector' test.version
<fails>
# Then in a salt state file:
{% if salt['pillar.get']('role') == 'collector' %}
Do something
{% else %}
Do something else
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment