aboutsummaryrefslogtreecommitdiffstats
path: root/roles/wireguard/tasks/main.yml
blob: 0e2343d4da374d45469a00bfebb0e919ee83f2ac (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
29
30
31
32
33
34
35
36
37
38
39
40
41
---

- name: create local wireguard directory
  ansible.builtin.file:
    path: "{{ wireguard_local_dir }}"
    state: directory
    mode: 0700
  run_once: true
  delegate_to: localhost

- name: create wireguard directory
  ansible.builtin.file:
    path: "{{ wireguard_dir }}"
    owner: 0
    group: 0
    mode: 0700
    state: directory

- name: include key generation
  ansible.builtin.include_tasks: keys.yml

- name: include configuration generation
  ansible.builtin.include_tasks: configuration.yml

- name: install wireguard on remote host
  ansible.builtin.package:
    name: wireguard-tools
    state: present

- name: include service configuration for hosts
  ansible.builtin.include_tasks: service.yml
  when: inventory_hostname == wireguard_domain_controller

- name: include service configuration for server
  ansible.builtin.include_tasks: "{{ task }}"
  when: inventory_hostname != wireguard_domain_controller
  loop_control:
    loop_var: task
  loop:
    - service.yml
    - cron.yml
remember that computers suck.