updated openvpn_client

This commit is contained in:
Paul 2020-07-10 01:56:49 +02:00
parent eaa6b99c5e
commit 51a0f7025c
5 changed files with 18 additions and 18 deletions

View File

@ -1,8 +1,8 @@
---
{%- from "openvpn_client/map.jinja" import openvpn with context %}
{%- from "openvpn_client/map.jinja" import openvpn_client with context %}
openvpn-client-main-config:
file.managed:
- name: {{ openvpn.config_dir }}/vpn.conf
- name: {{ openvpn_client.config_dir }}/vpn.conf
- source: salt://openvpn_client/vpn.conf.j2
- user: root
- group: root
@ -13,7 +13,7 @@ openvpn-client-main-config:
openvpn-client-private-dir:
file.directory:
- name: {{ openvpn.config_dir }}/vpn
- name: {{ openvpn_client.config_dir }}/private
- user: root
- group: root
- mode: 0700
@ -22,7 +22,7 @@ openvpn-client-private-dir:
openvpn-client-private-access:
file.managed:
- name: {{ openvpn.config_dir }}/vpn/pass
- name: {{ openvpn_client.config_dir }}/private/pass
- source: salt://openvpn_client/pass.j2
- template: jinja
- user: root

View File

@ -1,3 +1,3 @@
---
openvpn:
openvpn_client:
config_dir: /etc/openvpn

View File

@ -1,5 +1,5 @@
{%- import_yaml "openvpn_client/defaults.yaml" as default_settings -%}
{%- set defaults = salt['grains.filter_by'](default_settings, default='openvpn') -%}
{%- set defaults = salt['grains.filter_by'](default_settings, default='openvpn_client') -%}
{%- set openvpn = salt['pillar.get']('openvpn', default=defaults, merge=True) -%}
{%- set openvpn_client = salt['pillar.get']('openvpn_client', default=defaults, merge=True) -%}

View File

@ -1,5 +1,5 @@
{%- from "openvpn_client/map.jinja" import openvpn with context -%}
{%- for client in openvpn.config.vpn.remote_hosts -%}
{%- from "openvpn_client/map.jinja" import openvpn_client with context -%}
{%- for client in openvpn_client.config.vpn.remote_hosts -%}
{%- if client.name == salt['grains.get']('host') -%}
{{ client.name }}
{{ client.password }}

View File

@ -1,17 +1,17 @@
## {{ salt['pillar.get']('salt_managed', default='Salt Managed') }}
{%- from "openvpn_client/map.jinja" import openvpn with context %}
{%- from "openvpn_client/map.jinja" import openvpn_client with context %}
<ca>
{{ openvpn.config.vpn.ca }}
{{ openvpn_client.config.vpn.ca }}
</ca>
<cert>
{{ openvpn.config.vpn.cert }}
{{ openvpn_client.config.vpn.cert }}
</cert>
<key>
{{ openvpn.config.vpn.key }}
{{ openvpn_client.config.vpn.key }}
</key>
client
remote {{ openvpn.config.vpn.global_endpoint_host }} {{ openvpn.config.vpn.global_endpoint_port }}
proto {{ openvpn.config.vpn.global_endpoint_proto }}
remote {{ openvpn_client.config.vpn.global_endpoint_host }} {{ openvpn_client.config.vpn.global_endpoint_port }}
proto {{ openvpn_client.config.vpn.global_endpoint_proto }}
dev tun
topology subnet
@ -26,4 +26,4 @@ persist-tun
compress lzo
fast-io
auth-user-pass vpn/pass
auth-user-pass private/pass