aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roles/wireguard/tasks/main.yml
blob: 29068c9f4ff10c89e8e65249bfda6d2bf887608a (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
- name: Set up Wireguard
  become: true
  block:
  - name: Install wireguard-tools
    ansible.builtin.apt:
      install_recommends: false
      name: wireguard-tools
      state: present
  
  - name: Config file
    ansible.builtin.template:
      src: wg0.conf
      dest: '/etc/wireguard/{{ wg_name }}.conf'
      owner: root
      group: root
      mode: '600'
    register: config

  - name: Restart wg-quick service
    ansible.builtin.systemd_service:
      name: 'wg-quick@{{ wg_name }}'
      enabled: true
      state: restarted
    when: config.changed