Add support for Archlinux

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2019-05-05 13:28:26 +02:00
parent 83f159ad32
commit 91f8baf981
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E
6 changed files with 60 additions and 20 deletions

View file

@ -4,6 +4,7 @@ This role installs OpenVPN on a host, configures a client connection and enables
## Requirements
- Archlinux
- Debian >= 8 (jessie)
- Ubuntu >= 16.04 (xenial)

View file

@ -15,6 +15,8 @@ galaxy_info:
versions:
- jessie
- stretch
- name: Archlinux
versions: [all]
categories:
#- cloud

24
tasks/Archlinux.yml Normal file
View 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
View file

@ -0,0 +1,5 @@
---
- include: "Ubuntu.yml"
...

25
tasks/Ubuntu.yml Normal file
View 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
...

View file

@ -1,23 +1,6 @@
---
- name: Install required package
apt:
name: openvpn
cache_valid_time: 86400
- name: "Loading distribution specific instructions for {{ ansible_distribution }}"
include: "{{ ansible_distribution }}.yml"
- 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
...