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.

22 rindas
622B

  1. {%- for interface in salt['pillar.get']('wireguard', {}).keys() %}
  2. wireguard_interface_{{interface}}:
  3. file.managed:
  4. - name: /etc/wireguard/{{interface}}.conf
  5. - contents_pillar: wireguard:{{interface}}:config
  6. - mode: 640
  7. {% if salt['pillar.get']('wireguard:' ~ interface ~ ':enable', True) %}
  8. restart wg-quick@{{interface}}:
  9. service.running:
  10. - name: wg-quick@{{interface}}
  11. - enable: True
  12. - watch:
  13. - file: wireguard_interface_{{interface}}
  14. {% else %}
  15. stop and disable wg-quick@{{interface}}:
  16. service.dead:
  17. - name: wg-quick@{{interface}}
  18. - enable: False
  19. {% endif %}
  20. {%- endfor %}