|
|
@ -67,8 +67,6 @@
|
|
|
|
- name: Generate WireGuard private key
|
|
|
|
- name: Generate WireGuard private key
|
|
|
|
shell: "wg genkey"
|
|
|
|
shell: "wg genkey"
|
|
|
|
register: wg_private_key_result
|
|
|
|
register: wg_private_key_result
|
|
|
|
with_inventory_hostnames:
|
|
|
|
|
|
|
|
- vpn
|
|
|
|
|
|
|
|
when: not private_key_file_stat.stat.exists
|
|
|
|
when: not private_key_file_stat.stat.exists
|
|
|
|
tags:
|
|
|
|
tags:
|
|
|
|
- wg-generate-keys
|
|
|
|
- wg-generate-keys
|
|
|
@ -76,7 +74,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
- name: Set private key fact
|
|
|
|
- name: Set private key fact
|
|
|
|
set_fact:
|
|
|
|
set_fact:
|
|
|
|
wg_private_key: "{{ wg_private_key_result.results[0].stdout }}"
|
|
|
|
wg_private_key: "{{ wg_private_key_result.stdout }}"
|
|
|
|
when: not private_key_file_stat.stat.exists
|
|
|
|
when: not private_key_file_stat.stat.exists
|
|
|
|
tags:
|
|
|
|
tags:
|
|
|
|
- wg-generate-keys
|
|
|
|
- wg-generate-keys
|
|
|
@ -85,14 +83,12 @@
|
|
|
|
shell: "echo '{{ wg_private_key }}' | wg pubkey"
|
|
|
|
shell: "echo '{{ wg_private_key }}' | wg pubkey"
|
|
|
|
register: wg_public_key_result
|
|
|
|
register: wg_public_key_result
|
|
|
|
when: not private_key_file_stat.stat.exists
|
|
|
|
when: not private_key_file_stat.stat.exists
|
|
|
|
with_inventory_hostnames:
|
|
|
|
|
|
|
|
- vpn
|
|
|
|
|
|
|
|
tags:
|
|
|
|
tags:
|
|
|
|
- wg-generate-keys
|
|
|
|
- wg-generate-keys
|
|
|
|
|
|
|
|
|
|
|
|
- name: Set public key fact
|
|
|
|
- name: Set public key fact
|
|
|
|
set_fact:
|
|
|
|
set_fact:
|
|
|
|
wg_public_key: "{{ wg_public_key_result.results[0].stdout }}"
|
|
|
|
wg_public_key: "{{ wg_public_key_result.stdout }}"
|
|
|
|
when: not private_key_file_stat.stat.exists
|
|
|
|
when: not private_key_file_stat.stat.exists
|
|
|
|
tags:
|
|
|
|
tags:
|
|
|
|
- wg-generate-keys
|
|
|
|
- wg-generate-keys
|
|
|
|