forked from davestephens/ansible-nas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vpn.yml
38 lines (34 loc) · 1.08 KB
/
vpn.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
---
- include_vars: group_vars/vpn_credentials.yml
- name: Create NordVPN Config Directory
file:
path: "{{ item }}"
state: directory
# mode: 0755
with_items:
- "{{ openvpn_config_directory }}/nordvpn"
- name: Download latest NordVPN configs
unarchive:
src: https://nordvpn.com/api/files/zip
dest: "{{ openvpn_config_directory }}/nordvpn"
remote_src: True
- name: Replace NordVPN configs with credential file
shell: 'sed -i "s/auth-user-pass/auth-user-pass \/config\/openvpn-credentials.txt/" {{ openvpn_config_directory }}/nordvpn/*.ovpn'
- name: VPN Container
docker_container:
name: openvpn-client
image: dceschmidt/openvpn-client
pull: true
env:
OPENVPN_PROVIDER: "{{ openvpn_provider }}"
OPENVPN_USERNAME: "{{ openvpn_username }}"
OPENVPN_PASSWORD: "{{ openvpn_password }}"
OPENVPN_CONFIG: "{{ openvpn_config }}"
volumes:
"{{ openvpn_config_directory }}/nordvpn:/etc/openvpn/conf/nordvpn:rw"
devices:
- /dev/net/tun
capabilities:
- NET_ADMIN
restart_policy: unless-stopped
memory: 1g