setup wireguard depending on vars
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
# Load distro specific variables
|
# Load distro specific variables
|
||||||
- include_vars: "{{ ansible_distribution }}.yml"
|
- include_vars: "{{ ansible_distribution }}.yml"
|
||||||
tags: always
|
tags: always
|
||||||
|
- include:vars: "{{ ansible_fqdn }}.yml"
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- include_tasks: system_setup/hosts.yml
|
- include_tasks: system_setup/hosts.yml
|
||||||
|
|||||||
@@ -8,6 +8,20 @@
|
|||||||
cmd: umask 077 && wg genkey | tee privatekey | wg pubkey > publickey
|
cmd: umask 077 && wg genkey | tee privatekey | wg pubkey > publickey
|
||||||
chdir: /etc/wireguard
|
chdir: /etc/wireguard
|
||||||
creates: /etc/wireguard/publickey
|
creates: /etc/wireguard/publickey
|
||||||
|
when:
|
||||||
|
- wg_privkey is not defined
|
||||||
|
- wg_pubkey is not defined
|
||||||
|
|
||||||
|
- name: server | utilities | wireguard copy keys
|
||||||
|
copy:
|
||||||
|
content: "{{ item.key }}"
|
||||||
|
dest: "{{ item.keyfile }}"
|
||||||
|
loop:
|
||||||
|
- { key: wg_pubkey, keyfile: "/etc/wireguard/publickey" }
|
||||||
|
- { key: wg_privkey, keyfile: "/etc/wireguard/privatekey" }
|
||||||
|
when:
|
||||||
|
- wg_pubkey is defined
|
||||||
|
- wg_privkey is defined
|
||||||
|
|
||||||
- name: server | utilities | wireguard generate config
|
- name: server | utilities | wireguard generate config
|
||||||
template:
|
template:
|
||||||
|
|||||||
Reference in New Issue
Block a user