MEschenbacher's Wireguard Saltstack Formula
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

36 rindas
1000B

  1. {% from "wireguard/map.jinja" import wireguard with context %}
  2. wireguard:
  3. pkg.installed:
  4. - name: {{ wireguard.package }}
  5. {% for name, values in salt['pillar.get']('wireguard:interfaces', {}).items() %}
  6. wireguard_{{ name }}:
  7. wg.present:
  8. - name: {{ name }}
  9. {% for k, v in values.items() %}
  10. - {{k}}: {{v}}
  11. {% endfor %}
  12. {% endfor %}
  13. {% for interface, peerlist in salt['pillar.get']('wireguard:peers', {}).items() %}
  14. {% for peer in peerlist %}
  15. wireguard_{{ interface }}_peer_{{ peer.get('peer') }}:
  16. wg.peer_present:
  17. - interface: {{ interface }}
  18. - name: {{ peer.get('peer') }}
  19. {% if peer.get('endpoint') != None %}
  20. - endpoint: {{ peer.get('endpoint') }}
  21. {% endif %}
  22. {% if peer.get('persistent_keepalive') != None %}
  23. - persistent_keepalive: {{ peer.get('persistent_keepalive') }}
  24. {% endif %}
  25. {% if peer.get('allowed_ips') != None %}
  26. - allowed_ips:
  27. {% for subnet in peer.get('allowed_ips', []) %}
  28. - {{subnet}}
  29. {% endfor %}
  30. {% endif %}
  31. {% endfor %}
  32. {% endfor %}