I would like to achieve a salt master reactor mechanism which is accepting new minions keys only if a certain string is found within the new minion custom pillar data.
If I run the below command on salt-master server before a new minion key is accepted I can see the new minion custom pillar data:
salt-run pillar.show_pillar 'minion'
and I get something like:
data:
attributes:
PROFILE:
profile1
DISK_FILESYSTEM:
xfs
DNS_SEARCH_DOMAINS:
google.com
etc
I would like to know if there is any method to translate the above command in something like:
{% set pillar_data = salt['pillar.show'](data['id'])%}
{% if 'profile1' in pillar_data %}
accept_only_certain_minions:
wheel.key.accept:
- args:
- match: {{ data['id'] }}
{% endif %}
salt['pillar.show'](data['id'])
within Jinja is not working cause the salt.utils does not have a pillar.show method:
salt.exceptions.SaltRenderError: Jinja variable 'salt.utils.templates.AliasedLoader object' has no attribute 'pillar.show'
Ionut Chisanovici is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.