MEschenbacher's Wireguard 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.

27 lines
593B

  1. {%- macro output(key, value) -%}
  2. {%- if key in ['Address', 'DNS', 'AllowedIPs'] -%}
  3. {{output_list(key, value)}}
  4. {%- else -%}
  5. {{key}} = {{value}}
  6. {%- endif -%}
  7. {%- endmacro -%}
  8. {%- macro output_list(key, value) -%}
  9. {%- if value is string -%}
  10. {{key}} = {{value}}
  11. {%- else -%}
  12. {%- for item in value %}
  13. {{key}} = {{item}}
  14. {%- endfor -%}
  15. {%- endif -%}
  16. {%- endmacro -%}
  17. [Interface]
  18. {% for key, value in interface.items() -%}
  19. {{ output(key, value) }}
  20. {% endfor -%}
  21. {%- for peer in peers -%}
  22. [Peer]
  23. {% for key, value in peer.items() -%}
  24. {{ output(key, value) }}
  25. {% endfor -%}
  26. {%- endfor -%}