mirror of
https://github.com/luzifer-ansible/openvpn.git
synced 2024-11-09 14:20:03 +00:00
Add support for Archlinux
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
83f159ad32
commit
91f8baf981
6 changed files with 60 additions and 20 deletions
|
@ -4,6 +4,7 @@ This role installs OpenVPN on a host, configures a client connection and enables
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
|
- Archlinux
|
||||||
- Debian >= 8 (jessie)
|
- Debian >= 8 (jessie)
|
||||||
- Ubuntu >= 16.04 (xenial)
|
- Ubuntu >= 16.04 (xenial)
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,8 @@ galaxy_info:
|
||||||
versions:
|
versions:
|
||||||
- jessie
|
- jessie
|
||||||
- stretch
|
- stretch
|
||||||
|
- name: Archlinux
|
||||||
|
versions: [all]
|
||||||
|
|
||||||
categories:
|
categories:
|
||||||
#- cloud
|
#- cloud
|
||||||
|
|
24
tasks/Archlinux.yml
Normal file
24
tasks/Archlinux.yml
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: Install required package
|
||||||
|
pacman:
|
||||||
|
name: openvpn
|
||||||
|
|
||||||
|
- name: Install client connection
|
||||||
|
template:
|
||||||
|
src: templates/client.conf
|
||||||
|
dest: /etc/openvpn/client/client.conf
|
||||||
|
register: openvpn_config
|
||||||
|
|
||||||
|
- name: Enable autostart for OpenVPN connection "client"
|
||||||
|
systemd:
|
||||||
|
name: openvpn-client@client.service
|
||||||
|
enabled: yes
|
||||||
|
|
||||||
|
- name: Restart OpenVPN connection when required
|
||||||
|
systemd:
|
||||||
|
name: openvpn-client@client.service
|
||||||
|
state: restarted
|
||||||
|
when: openvpn_config.changed
|
||||||
|
|
||||||
|
...
|
5
tasks/Debian.yml
Normal file
5
tasks/Debian.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- include: "Ubuntu.yml"
|
||||||
|
|
||||||
|
...
|
25
tasks/Ubuntu.yml
Normal file
25
tasks/Ubuntu.yml
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: Install required package
|
||||||
|
apt:
|
||||||
|
name: openvpn
|
||||||
|
cache_valid_time: 86400
|
||||||
|
|
||||||
|
- name: Install client connection
|
||||||
|
template:
|
||||||
|
src: templates/client.conf
|
||||||
|
dest: /etc/openvpn/client.conf
|
||||||
|
register: openvpn_config
|
||||||
|
|
||||||
|
- name: Enable autostart for OpenVPN connection "client"
|
||||||
|
systemd:
|
||||||
|
name: openvpn@client.service
|
||||||
|
enabled: yes
|
||||||
|
|
||||||
|
- name: Restart OpenVPN connection when required
|
||||||
|
systemd:
|
||||||
|
name: openvpn@client.service
|
||||||
|
state: restarted
|
||||||
|
when: openvpn_config.changed
|
||||||
|
|
||||||
|
...
|
|
@ -1,23 +1,6 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- name: Install required package
|
- name: "Loading distribution specific instructions for {{ ansible_distribution }}"
|
||||||
apt:
|
include: "{{ ansible_distribution }}.yml"
|
||||||
name: openvpn
|
|
||||||
cache_valid_time: 86400
|
|
||||||
|
|
||||||
- name: Install client connection
|
...
|
||||||
template:
|
|
||||||
src: templates/client.conf
|
|
||||||
dest: /etc/openvpn/client.conf
|
|
||||||
register: openvpn_config
|
|
||||||
|
|
||||||
- name: Enable autostart for OpenVPN connection "client"
|
|
||||||
systemd:
|
|
||||||
name: openvpn@client.service
|
|
||||||
enabled: yes
|
|
||||||
|
|
||||||
- name: Restart OpenVPN connection when required
|
|
||||||
systemd:
|
|
||||||
name: openvpn@client.service
|
|
||||||
state: restarted
|
|
||||||
when: openvpn_config.changed
|
|
||||||
|
|
Loading…
Reference in a new issue