paulbsd-salt/states/openvpn_server/config.sls

28 lines
794 B
Plaintext

---
{%- from "openvpn_server/map.jinja" import openvpn_server with context %}
{%- for key, instance in openvpn_server.config.items() %}
openvpn-server-{{ key }}-config:
file.managed:
- name: /etc/openvpn/{{ key }}.conf
- source: salt://openvpn_server/templates/{{ key }}.conf.j2
- user: root
- group: root
- mode: 0600
- template: jinja
- context:
ca: |
{{ instance.ca|indent(8) }}
cert: |
{{ instance.cert|indent(8) }}
key: |
{{ instance.key|indent(8) }}
dh: |
{{ instance.dh|indent(8) }}
routes: {{ instance.routes }}
config: {{ instance.config }}
tunnel: {{ instance.tunnel }}
dns: {{ instance.dns }}
- watch_in:
- service: openvpn-server-{{ key }}-service
{%- endfor %}