blob: 9a8d67c4ea3a4a2088647a46d6e7d403e2971b02 (
plain) (
tree)
|
|
# 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 }}"
|