Bechtoldt's Network Saltstack Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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 %}