summaryrefslogtreecommitdiff
path: root/roles/network/openvpn/server/tasks/main.yml
blob: 181feec9ea7e6c1168d0b77d1b4c0a2f87fd26bf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
---
- name: create TLS certificate and key
  import_tasks: tls.yml

- name: generate openvpn config
  template:
    src: conf.j2
    dest: "/etc/openvpn/server/{{ openvpn_zone.name }}.conf"
  notify: restart openvpn-server

- name: create client-config directory
  file:
    path: "/etc/openvpn/server/{{ openvpn_zone.name }}-ccd"
    state: directory

- name: generate client-config snippets
  loop: "{{ openvpn_zone.offsets | list | difference([inventory_hostname]) }}"
  loop_control:
    loop_var: client
  template:
    src: client.j2
    dest: "/etc/openvpn/server/{{ openvpn_zone.name }}-ccd/{{ client }}"

- name: make sure openvpn-server systemd unit is enabled and started
  systemd:
    name: "openvpn-server@{{ openvpn_zone.name }}"
    state: started
    enabled: yes