This commit is contained in:
parent
cf02110610
commit
6a71faa307
@ -17,9 +17,9 @@
|
|||||||
- name: Generate WireGuard private key
|
- name: Generate WireGuard private key
|
||||||
command: "wg genkey"
|
command: "wg genkey"
|
||||||
register: __wireguard_private_key_gen
|
register: __wireguard_private_key_gen
|
||||||
changed_when: false
|
changed_when: False
|
||||||
|
|
||||||
- name: Set private key fact
|
- name: Set generated private key
|
||||||
set_fact:
|
set_fact:
|
||||||
wireguard_private_key: "{{ __wireguard_private_key_gen.stdout }}"
|
wireguard_private_key: "{{ __wireguard_private_key_gen.stdout }}"
|
||||||
when:
|
when:
|
||||||
@ -34,7 +34,7 @@
|
|||||||
src: "/etc/wireguard/{{ wireguard_interface }}.conf"
|
src: "/etc/wireguard/{{ wireguard_interface }}.conf"
|
||||||
register: __wireguard_config
|
register: __wireguard_config
|
||||||
|
|
||||||
- name: Set private key fact
|
- name: Set existing private key
|
||||||
set_fact:
|
set_fact:
|
||||||
wireguard_private_key: "{{ __wireguard_config['content'] | b64decode | regex_findall('PrivateKey = (.*)') | first }}"
|
wireguard_private_key: "{{ __wireguard_config['content'] | b64decode | regex_findall('PrivateKey = (.*)') | first }}"
|
||||||
when:
|
when:
|
||||||
|
@ -52,7 +52,7 @@ AllowedIPs = {{ hostvars[host].wireguard_address.split('/')[0] }}/32
|
|||||||
{% if hostvars[host].wireguard_persistent_keepalive is defined %}
|
{% if hostvars[host].wireguard_persistent_keepalive is defined %}
|
||||||
PersistentKeepalive = {{ hostvars[host].wireguard_persistent_keepalive }}
|
PersistentKeepalive = {{ hostvars[host].wireguard_persistent_keepalive }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if hostvars[host].wireguard_endpoint is not defined or hostvars[host].wireguard_endpoint != "" %}
|
{% if hostvars[host].wireguard_endpoint is not defined or not hostvars[host].wireguard_endpoint %}
|
||||||
Endpoint = {{ hostvars[host].wireguard_endpoint | default(host) }}:{{ hostvars[host].wireguard_port | default(wireguard_port) }}
|
Endpoint = {{ hostvars[host].wireguard_endpoint | default(host) }}:{{ hostvars[host].wireguard_port | default(wireguard_port) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Loading…
Reference in New Issue
Block a user