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.

pirms 6 gadiem
pirms 6 gadiem
pirms 6 gadiem
pirms 6 gadiem
pirms 6 gadiem
pirms 6 gadiem
pirms 6 gadiem
pirms 6 gadiem
pirms 6 gadiem
123456789101112131415161718192021222324252627282930313233343536373839404142
  1. {% from "wireguard/map.jinja" import wireguard with context %}
  2. {% for interface, values in salt['pillar.get']('wireguard:interfaces', {}).items() %}
  3. wireguard_{{ interface }}:
  4. wg.present:
  5. - name: {{ interface }}
  6. {% for k, v in values.items() %}
  7. {% if k in ['listen_port', 'fwmark', 'private_key', 'preshared_key'] %}
  8. - {{k}}: {{v}}
  9. {% endif %}
  10. {% endfor %} {# values.items() #}
  11. {% for peer in values.get('peers', {}) %}
  12. wireguard_{{ interface }}_peer_{{ peer.get('peer') }}:
  13. wg.peer_present:
  14. - interface: {{ interface }}
  15. - name: {{ peer.get('peer') }}
  16. {% if peer.get('endpoint') != None %}
  17. - endpoint: '{{ peer.get('endpoint') }}'
  18. {% endif %}
  19. {% if peer.get('persistent_keepalive') != None %}
  20. - persistent_keepalive: {{ peer.get('persistent_keepalive') }}
  21. {% endif %}
  22. {% if peer.get('allowed_ips') != None %}
  23. - allowed_ips:
  24. {% for subnet in peer.get('allowed_ips', []) %}
  25. - {{subnet}}
  26. {% endfor %}
  27. {% endif %}
  28. {% endfor %}
  29. {% endfor %}
  30. {% for interface in salt['pillar.get']('wireguard:set_forward_interfaces', []) %}
  31. net.ipv4.conf.{{interface}}.forwarding:
  32. sysctl.present:
  33. - value: 1
  34. net.ipv6.conf.{{interface}}.forwarding:
  35. sysctl.present:
  36. - value: 1
  37. {% endfor %}