Am Fri, 22 May 2020 08:01:27 +0200
schrieb Stefan Bogner
You can use jinja within states to achieve that:
{% if salt.grains.get('host') == 'server01' %}
...your state data...
{% endif %}
Thanks for your idea! As yet I haven't had a look at jinja but as this approach came close to what I was looking for I gave it a try. With some examples from the web finally I found this solution that works fine now:
access.conf: file.managed: - name: /etc/security/access.conf {% if salt.grains.get('host') == 'server01' %} - source: salt://manager_org_1/SLES15-WF-SrvSpez-SLS/etc/security/access.conf-prodvvvo {% elif salt.grains.get('host') == 'server02' %} - source: salt://manager_org_1/SLES15-WF-SrvSpez-SLS/etc/security/access.conf-prodwebservice {% else %} - source: salt://manager_org_1/SLES15-WF-SrvSpez-SLS/etc/security/access.conf-testserver {% endif %} - user: root - group: root - mode: '0644'
(BTW: the source files were created as configuration-(text-)files within the same configuration channel) -- Gruss, Tobias Crefeld. xmpp (no email): crefeld@xabber.de -- To unsubscribe, e-mail: uyuni-users+unsubscribe@opensuse.org To contact the owner, e-mail: uyuni-users+owner@opensuse.org