blob: 29a34771c591240d74ed890d3ddb8bf3688c9863 [file] [log] [blame]
---
# openvpn tasks/main.yml
#
# SPDX-FileCopyrightText: 2022 Open Networking Foundation <support@opennetworking.org>
# SPDX-License-Identifier: Apache-2.0
- name: include OS-specific vars
include_vars: "{{ ansible_os_family }}.yml"
- name: include OS-specific tasks
include_tasks: "{{ ansible_os_family }}.yml"
- name: Copy certificate
copy:
src: "{{ item }}"
dest: "{{ openvpn_conf_dir }}/server/{{ item }}"
owner: root
group: root
mode: 0640
loop:
- chain.pem
- ca.crl
- openvpn_server.pem
- openvpn_server.key
- ta.key
- dh.pem
- name: Create openvpn server config file
template:
src: server.conf.j2
dest: "{{ openvpn_conf_dir }}/server.conf"
backup: true
owner: root
group: "{{ openvpn_groupname }}"
mode: 0755
notify:
- restart-openvpn
- name: start and enable openvpn
service:
name: "{{ openvpn_service }}"
state: started
enabled: true