Compare commits
11 commits
Author | SHA1 | Date | |
---|---|---|---|
KemoNine | 53efc122e3 | ||
KemoNine | 0217d41830 | ||
KemoNine | ef8de286b1 | ||
KemoNine | fbc79beb72 | ||
KemoNine | d1ed058fa8 | ||
KemoNine | d00bcb7d6a | ||
KemoNine | 0afb85375e | ||
KemoNine | 1faf8d9f12 | ||
KemoNine | 8fc7870c76 | ||
d5b81cb75e | |||
1997b9d710 |
|
@ -1,6 +1,10 @@
|
||||||
Changelog
|
Changelog
|
||||||
---------
|
---------
|
||||||
|
|
||||||
|
**6.3.1**
|
||||||
|
|
||||||
|
- Support Openstack Debian images (contribution by @pallinger)
|
||||||
|
|
||||||
**6.3.0**
|
**6.3.0**
|
||||||
|
|
||||||
- Support Raspbian (contribution by @penguineer)
|
- Support Raspbian (contribution by @penguineer)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# Fork of https://github.com/githubixx/ansible-role-wireguard.git with some minor tweaks to ensure PiFrameFleet can be provisioned properly
|
||||||
|
|
||||||
ansible-role-wireguard
|
ansible-role-wireguard
|
||||||
======================
|
======================
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,9 @@ wireguard_port: "51820"
|
||||||
# The default interface name that wireguard should use if not specified otherwise.
|
# The default interface name that wireguard should use if not specified otherwise.
|
||||||
wireguard_interface: "wg0"
|
wireguard_interface: "wg0"
|
||||||
|
|
||||||
|
# Whether or not WireGuard is running in a container
|
||||||
|
wireguard_containerized: false
|
||||||
|
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
# Settings only relevant for Ubuntu
|
# Settings only relevant for Ubuntu
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
loop:
|
loop:
|
||||||
- stopped
|
- stopped
|
||||||
- started
|
- started
|
||||||
when: not wg_syncconf
|
when: not wg_syncconf and not wireguard_containerized
|
||||||
listen: "reconfigure wireguard"
|
listen: "reconfigure wireguard"
|
||||||
|
|
||||||
- name: syncconf wireguard
|
- name: syncconf wireguard
|
||||||
|
@ -19,5 +19,10 @@
|
||||||
exit 0
|
exit 0
|
||||||
args:
|
args:
|
||||||
executable: "/bin/bash"
|
executable: "/bin/bash"
|
||||||
when: wg_syncconf
|
when: wg_syncconf and not wireguard_containerized
|
||||||
|
listen: "reconfigure wireguard"
|
||||||
|
|
||||||
|
- name: restart wireguard (container)
|
||||||
|
command: /usr/bin/s6-svc -r /var/run/s6/services/wireguard
|
||||||
|
when: wireguard_containerized
|
||||||
listen: "reconfigure wireguard"
|
listen: "reconfigure wireguard"
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
setup:
|
setup:
|
||||||
|
|
||||||
- include_tasks: "setup-{{ ansible_distribution|lower }}.yml"
|
- include_tasks: "setup-{{ ansible_distribution|lower }}.yml"
|
||||||
|
when: not wireguard_containerized
|
||||||
|
|
||||||
- name: Enable WireGuard kernel module
|
- name: Enable WireGuard kernel module
|
||||||
modprobe:
|
modprobe:
|
||||||
|
@ -129,3 +130,4 @@
|
||||||
name: "wg-quick@{{ wireguard_interface }}"
|
name: "wg-quick@{{ wireguard_interface }}"
|
||||||
state: started
|
state: started
|
||||||
enabled: yes
|
enabled: yes
|
||||||
|
when: not wireguard_containerized
|
||||||
|
|
|
@ -18,10 +18,13 @@
|
||||||
register: dpkg_arch
|
register: dpkg_arch
|
||||||
changed_when: False
|
changed_when: False
|
||||||
|
|
||||||
|
- set_fact:
|
||||||
|
kernel_header_version: "{{ ('-cloud-' in ansible_kernel) | ternary(ansible_kernel,dpkg_arch.stdout) }}"
|
||||||
|
|
||||||
- name: (Debian) Install kernel headers to compile Wireguard with DKMS
|
- name: (Debian) Install kernel headers to compile Wireguard with DKMS
|
||||||
apt:
|
apt:
|
||||||
name:
|
name:
|
||||||
- "linux-headers-{{ dpkg_arch.stdout }}"
|
- "linux-headers-{{ kernel_header_version }}"
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: (Debian) Install wireguard packages
|
- name: (Debian) Install wireguard packages
|
||||||
|
|
|
@ -39,32 +39,32 @@ PostDown = {{ wg_postdown }}
|
||||||
{% if hostvars[inventory_hostname].wireguard_save_config is defined %}
|
{% if hostvars[inventory_hostname].wireguard_save_config is defined %}
|
||||||
SaveConfig = true
|
SaveConfig = true
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% for host in ansible_play_hosts %}
|
{% for host in ansible_play_hosts_all %}
|
||||||
{% if host != inventory_hostname %}
|
{% if host != inventory_hostname %}
|
||||||
|
|
||||||
[Peer]
|
[Peer]
|
||||||
# {{ host }}
|
# {{ host }}
|
||||||
PublicKey = {{hostvars[host].public_key}}
|
PublicKey = {{hostvars[host].public_key}}
|
||||||
{% if hostvars[host].wireguard_allowed_ips is defined %}
|
{% if hostvars[host].wireguard_allowed_ips is defined %}
|
||||||
AllowedIPs = {{hostvars[host].wireguard_allowed_ips}}
|
AllowedIPs = {{hostvars[host].wireguard_allowed_ips}}
|
||||||
{% else %}
|
{% else %}
|
||||||
AllowedIPs = {{hostvars[host].wireguard_ip}}/32
|
AllowedIPs = {{hostvars[host].wireguard_ip}}/32
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% 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_port is defined and hostvars[host].wireguard_port is number %}
|
{% if hostvars[host].wireguard_port is defined and hostvars[host].wireguard_port is number %}
|
||||||
{% if hostvars[host].wireguard_endpoint is defined and hostvars[host].wireguard_endpoint != "" %}
|
{% if hostvars[host].wireguard_endpoint is defined and hostvars[host].wireguard_endpoint != "" %}
|
||||||
Endpoint = {{hostvars[host].wireguard_endpoint}}:{{hostvars[host].wireguard_port}}
|
Endpoint = {{hostvars[host].wireguard_endpoint}}:{{hostvars[host].wireguard_port}}
|
||||||
{% else %}
|
{% else %}
|
||||||
Endpoint = {{host}}:{{hostvars[host].wireguard_port}}
|
Endpoint = {{host}}:{{hostvars[host].wireguard_port}}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% elif hostvars[host].wireguard_endpoint is defined and hostvars[host].wireguard_endpoint != "" %}
|
{% elif hostvars[host].wireguard_endpoint is defined and hostvars[host].wireguard_endpoint != "" %}
|
||||||
Endpoint = {{hostvars[host].wireguard_endpoint}}:{{wireguard_port}}
|
Endpoint = {{hostvars[host].wireguard_endpoint}}:{{wireguard_port}}
|
||||||
{% elif hostvars[host].wireguard_endpoint == "" %}
|
{% elif hostvars[host].wireguard_endpoint == "" %}
|
||||||
# No endpoint defined for this peer
|
# No endpoint defined for this peer
|
||||||
{% else %}
|
{% else %}
|
||||||
Endpoint = {{host}}:{{wireguard_port}}
|
Endpoint = {{host}}:{{wireguard_port}}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
Reference in a new issue