# 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 }}"