aboutsummaryrefslogtreecommitdiffstats
path: root/roles/wireguard/tasks/server.yml
blob: 9a8d67c4ea3a4a2088647a46d6e7d403e2971b02 (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

# wireguard ~~ roles/wireguard/tasks/main.yml
# create keys and configuration for wireguard hosts

---

- name: generate server configuration
  template:
    src: dcontroller.conf.j2
    dest: "{{ wg_dir }}/{{ ansible_host }}.conf"
    mode: "0600"
  when: ansible_host == global.dcontroller
  delegate_to: localhost

- name: enable wireguard interface
  lineinfile:
    path: /etc/rc.local
    regexp: "^wg-quick up {{ ansible_host }}$"
    line: "wg-quick up {{ ansible_host }}"

- name: restart wireguard interface
  shell: |
    wg-quick down "{{ ansible_host }}"
    wg-quick up "{{ ansible_host }}"
remember that computers suck.