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

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