minion根据主机名拿对应的值pillar example:foo: bar: host1: a host2: bsls example:touch file: file.manag
minion根据主机名拿对应的值
pillar example:
foo: bar: host1: a host2: b
sls example:
touch file: file.managed: - name: /tmp/myid - source: "salt://files/myid.j2" - template: jinja - context: bar: {{ salt['pillar.get']('foo.bar', '{}') }}
myid.j2 example:
{%- set hostname = grains['host'] -%}{{ bar[hostname] }}
debug filesystem
salt-run fileserver.file_listsalt-run fileserver.update
jinja if 多value
{% if xxx in [bar,foo] %}{% endif %}