Bechtoldt's Network Saltstack Formula
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718
  1. #!jinja|yaml
  2. {% from "network/defaults.yaml" import rawmap with context %}
  3. {% set datamap = salt['grains.filter_by'](rawmap, merge=salt['pillar.get']('network:lookup')) %}
  4. {% set hosts = datamap.hosts.def_entries %}
  5. {% if salt['pillar.get']('network:hosts', False) %}
  6. {% set hosts = hosts + salt['pillar.get']('network:hosts') %}
  7. {% endif %}
  8. {% for h in hosts %}
  9. host_{{ h.name }}_{{ h.ip }}:
  10. host:
  11. - {{ h.ensure|default('present') }}
  12. - ip: {{ h.ip }}
  13. - name: {{ h.name }}
  14. {% endfor %}