blob: 29a34771c591240d74ed890d3ddb8bf3688c9863 [file] [log] [blame]
Zack Williamsbecdc0e2022-03-26 07:08:25 -07001---
2# openvpn tasks/main.yml
3#
4# SPDX-FileCopyrightText: 2022 Open Networking Foundation <support@opennetworking.org>
5# SPDX-License-Identifier: Apache-2.0
6
7- name: include OS-specific vars
8 include_vars: "{{ ansible_os_family }}.yml"
9
10- name: include OS-specific tasks
11 include_tasks: "{{ ansible_os_family }}.yml"
12
13- name: Copy certificate
14 copy:
15 src: "{{ item }}"
16 dest: "{{ openvpn_conf_dir }}/server/{{ item }}"
17 owner: root
18 group: root
19 mode: 0640
20 loop:
21 - chain.pem
22 - ca.crl
23 - openvpn_server.pem
24 - openvpn_server.key
25 - ta.key
26 - dh.pem
27
28- name: Create openvpn server config file
29 template:
30 src: server.conf.j2
31 dest: "{{ openvpn_conf_dir }}/server.conf"
32 backup: true
33 owner: root
34 group: "{{ openvpn_groupname }}"
35 mode: 0755
36 notify:
37 - restart-openvpn
38
39- name: start and enable openvpn
40 service:
41 name: "{{ openvpn_service }}"
42 state: started
43 enabled: true