ansible-nas/tasks/vpn.yml

39 lines
1.1 KiB
YAML
Raw Normal View History

2018-04-07 10:29:22 +00:00
---
- 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