Merge branch 'master' into devel
This commit is contained in:
commit
0741099312
30
CHANGELOG.md
30
CHANGELOG.md
|
@ -1,9 +1,35 @@
|
||||||
Changelog
|
Changelog
|
||||||
---------
|
---------
|
||||||
|
|
||||||
**Unreleased**
|
**6.3.0**
|
||||||
|
|
||||||
|
- Allow to generate keys and configuration for non-ansible hosts like smartphones with `wireguard_unmanaged_hosts` (see `defaults/main.yml`) (contribution by @juju4)
|
||||||
|
|
||||||
|
**6.2.0**
|
||||||
|
|
||||||
|
- Support Ubuntu 20.04 (Focal Fossa)
|
||||||
|
- Introduce `wireguard_ubuntu_update_cache` and `wireguard_ubuntu_cache_valid_time` variables to specifiy individual Ubuntu package cache settings. Default values are the same as before.
|
||||||
|
- As kernel >= 5.6 (and kernel 5.4 in Ubuntu 20.04) now have `wireguard` module included `wireguard-dkms` package is no longer needed in that case. That's why WireGuard package installation is now part of the includes for the specific OS to make it easier to handle various cases.
|
||||||
|
|
||||||
|
**6.1.0**
|
||||||
|
|
||||||
|
- Archlinux: Linux kernel >= 5.6 contains `wireguard` module now. No need to install `wireguard-dkms` anymore in this case. Installations with LTS kernel installs `wireguard-lts` package now instead of `wireguard-dkms`. Installations with kernel <= 5.6 will still install `wireguard-dkms` package.
|
||||||
|
|
||||||
|
**6.0.4**
|
||||||
|
|
||||||
|
- Use the buster-backports repository on Debian Buster (or older), use package standard repositories on sid/bullseye.
|
||||||
|
standard repositories on sid/bullseye.
|
||||||
|
|
||||||
|
The role no longer adds the unstable _repo_ nor the _apt preference_ for that repo. There is no need to clean the preference and unstable repository, since packages from your release have a higher priority.
|
||||||
|
|
||||||
|
If you remove the apt preference (`/etc/apt/preferences.d/limit-unstable`) updates from `unstable` are accepted by apt. This likely is not what you want and may lead to an unstable state.
|
||||||
|
|
||||||
|
If you want to clean up:
|
||||||
|
* remove `/etc/apt/preferences.d/limit-unstable` and
|
||||||
|
* remove `deb http://deb.debian.org/debian/ unstable main` from `/etc/apt/sources.list.d/deb_debian_org_debian.list`.
|
||||||
|
|
||||||
|
The backports repository has a lower priority and does not need an apt preference.
|
||||||
|
|
||||||
- Allow to generate keys and configuration for non-ansible hosts like smartphones with `wireguard_unmanaged_hosts` (contribution by @juju4)
|
|
||||||
|
|
||||||
**6.0.3**
|
**6.0.3**
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ I used [PeerVPN](https://peervpn.net/) before but that wasn't updated for a whil
|
||||||
|
|
||||||
In general WireGuard is a network tunnel (VPN) for IPv4 and IPv6 that uses UDP. If you need more information about [WireGuard](https://www.wireguard.io/) you can find a good introduction here: [Installing WireGuard, the Modern VPN](https://research.kudelskisecurity.com/2017/06/07/installing-wireguard-the-modern-vpn/).
|
In general WireGuard is a network tunnel (VPN) for IPv4 and IPv6 that uses UDP. If you need more information about [WireGuard](https://www.wireguard.io/) you can find a good introduction here: [Installing WireGuard, the Modern VPN](https://research.kudelskisecurity.com/2017/06/07/installing-wireguard-the-modern-vpn/).
|
||||||
|
|
||||||
This role was tested with Ubuntu 18.04 (Bionic Beaver), Debian 9 (Stretch), Archlinux, Fedora 31 and CentOS. It might also work with Ubuntu 16.04 (Xenial Xerus), Debian 10 (Buster) or other distributions but haven't tested it. If someone tested it let me please know if it works or send a pull request to make it work ;-)
|
This role is tested with Ubuntu 18.04 (Bionic Beaver), Ubuntu 20 (Focal Fossa) and Archlinux. Ubuntu 16.04 (Xenial Xerus), Debian 9 (Stretch), Debian 10 (Buster), Fedora 31 (or later) and CentOS 7 might also work or other distributions but haven't tested it (code for this operating systems was submitted by other contributors). If someone tested it let me please know if it works or send a pull request to make it work ;-)
|
||||||
|
|
||||||
Versions
|
Versions
|
||||||
--------
|
--------
|
||||||
|
@ -308,11 +308,13 @@ vpn1:
|
||||||
|
|
||||||
vpn2:
|
vpn2:
|
||||||
hosts:
|
hosts:
|
||||||
# use a different name, and define ansible_host, to avoid mixing of vars without needing to prefix vars with interface name
|
# Use a different name, and define ansible_host, to avoid mixing of vars without
|
||||||
|
# needing to prefix vars with interface name.
|
||||||
multi-wg1:
|
multi-wg1:
|
||||||
ansible_host: multi
|
ansible_host: multi
|
||||||
wireguard_interface: wg1
|
wireguard_interface: wg1
|
||||||
wireguard_port: 51821 # when using several interface on one host, we must use different ports
|
# when using several interface on one host, we must use different ports
|
||||||
|
wireguard_port: 51821
|
||||||
wireguard_address: 10.9.1.1/32
|
wireguard_address: 10.9.1.1/32
|
||||||
wireguard_endpoint: multi.exemple.com
|
wireguard_endpoint: multi.exemple.com
|
||||||
another:
|
another:
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
---
|
---
|
||||||
|
#######################################
|
||||||
|
# General settings
|
||||||
|
#######################################
|
||||||
|
|
||||||
# Directory to store WireGuard configuration on the remote hosts
|
# Directory to store WireGuard configuration on the remote hosts
|
||||||
wireguard_remote_directory: "/etc/wireguard"
|
wireguard_remote_directory: "/etc/wireguard"
|
||||||
|
|
||||||
|
@ -9,9 +13,19 @@ wireguard_port: "51820"
|
||||||
wireguard_interface: "wg0"
|
wireguard_interface: "wg0"
|
||||||
|
|
||||||
#wireguard_unmanaged_hosts:
|
#wireguard_unmanaged_hosts:
|
||||||
# - host: 'test'
|
# - host: 'test1'
|
||||||
# allowed_ips: 10.200.10.10/32
|
# allowed_ips: 10.200.10.10/32
|
||||||
# dns: 10.200.10.1
|
# dns: 10.200.10.1
|
||||||
# - host: 'test2'
|
# - host: 'test2'
|
||||||
# allowed_ips: 10.200.10.11/32
|
# allowed_ips: 10.200.10.11/32
|
||||||
# dns: 10.200.10.1
|
# dns: 10.200.10.1
|
||||||
|
|
||||||
|
#######################################
|
||||||
|
# Settings only relevant for Ubuntu
|
||||||
|
#######################################
|
||||||
|
|
||||||
|
# Set to "false" if package cache should not be updated
|
||||||
|
wireguard_ubuntu_update_cache: "true"
|
||||||
|
|
||||||
|
# Set package cache valid time
|
||||||
|
wireguard_ubuntu_cache_valid_time: "3600"
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
Package: *
|
|
||||||
Pin: release a=unstable
|
|
||||||
Pin-Priority: 90
|
|
|
@ -8,9 +8,11 @@ galaxy_info:
|
||||||
- name: Ubuntu
|
- name: Ubuntu
|
||||||
versions:
|
versions:
|
||||||
- bionic
|
- bionic
|
||||||
|
- focal
|
||||||
- name: Debian
|
- name: Debian
|
||||||
versions:
|
versions:
|
||||||
- stretch
|
- stretch
|
||||||
|
- buster
|
||||||
- name: EL
|
- name: EL
|
||||||
versions:
|
versions:
|
||||||
- 7
|
- 7
|
||||||
|
|
|
@ -4,17 +4,6 @@
|
||||||
|
|
||||||
- include_tasks: "setup-{{ ansible_distribution|lower }}.yml"
|
- include_tasks: "setup-{{ ansible_distribution|lower }}.yml"
|
||||||
|
|
||||||
- name: Install WireGuard
|
|
||||||
package:
|
|
||||||
name: "{{ packages }}"
|
|
||||||
state: present
|
|
||||||
vars:
|
|
||||||
packages:
|
|
||||||
- wireguard-dkms
|
|
||||||
- wireguard-tools
|
|
||||||
tags:
|
|
||||||
- wg-install
|
|
||||||
|
|
||||||
- name: Enable WireGuard kernel module
|
- name: Enable WireGuard kernel module
|
||||||
modprobe:
|
modprobe:
|
||||||
name: wireguard
|
name: wireguard
|
||||||
|
@ -59,8 +48,9 @@
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Generate WireGuard private key
|
- name: Generate WireGuard private key
|
||||||
shell: "wg genkey"
|
command: "wg genkey"
|
||||||
register: wg_private_key_result
|
register: wg_private_key_result
|
||||||
|
changed_when: false
|
||||||
tags:
|
tags:
|
||||||
- wg-generate-keys
|
- wg-generate-keys
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,32 @@
|
||||||
---
|
---
|
||||||
- name: Install required packages
|
- name: (Archlinux) Install wireguard-lts package
|
||||||
pacman:
|
pacman:
|
||||||
name: "{{ packages }}"
|
name: "{{ item.name }}"
|
||||||
state: present
|
state: "{{ item.state }}"
|
||||||
|
with_items:
|
||||||
|
- { name: wireguard-dkms, state: absent }
|
||||||
|
- { name: wireguard-lts, state: present }
|
||||||
become: yes
|
become: yes
|
||||||
vars:
|
tags:
|
||||||
packages:
|
- wg-install
|
||||||
- linux-headers
|
when:
|
||||||
|
- ansible_kernel is match(".*-lts$")
|
||||||
|
- ansible_kernel is version('5.6', '<')
|
||||||
|
|
||||||
|
- name: (Archlinux) Install wireguard-dkms package
|
||||||
|
pacman:
|
||||||
|
name: wireguard-dkms
|
||||||
|
state: present
|
||||||
|
become: yes
|
||||||
|
tags:
|
||||||
|
- wg-install
|
||||||
|
when:
|
||||||
|
- not ansible_kernel is match(".*-lts$")
|
||||||
|
- ansible_kernel is version('5.6', '<')
|
||||||
|
|
||||||
|
- name: (Archlinux) Install wireguard-tools package
|
||||||
|
pacman:
|
||||||
|
name: wireguard-tools
|
||||||
|
state: present
|
||||||
tags:
|
tags:
|
||||||
- wg-install
|
- wg-install
|
||||||
|
|
|
@ -1,11 +1,19 @@
|
||||||
---
|
---
|
||||||
|
- name: (CentOS) Add WireGuard repository
|
||||||
- name: Add WireGuard repository
|
|
||||||
get_url:
|
get_url:
|
||||||
url: https://copr.fedorainfracloud.org/coprs/jdoss/wireguard/repo/epel-7/jdoss-wireguard-epel-7.repo
|
url: https://copr.fedorainfracloud.org/coprs/jdoss/wireguard/repo/epel-7/jdoss-wireguard-epel-7.repo
|
||||||
dest: /etc/yum.repos.d/wireguard.repo
|
dest: /etc/yum.repos.d/wireguard.repo
|
||||||
|
|
||||||
- name: Install EPEL repository
|
- name: (CentOS) Install EPEL repository
|
||||||
yum:
|
yum:
|
||||||
name: epel-release
|
name: epel-release
|
||||||
update_cache: yes
|
update_cache: yes
|
||||||
|
|
||||||
|
- name: (CentOS) Install wireguard packages
|
||||||
|
yum:
|
||||||
|
name:
|
||||||
|
- "wireguard-dkms"
|
||||||
|
- "wireguard-tools"
|
||||||
|
state: present
|
||||||
|
tags:
|
||||||
|
- wg-install
|
||||||
|
|
|
@ -1,42 +1,34 @@
|
||||||
---
|
---
|
||||||
- name: Setup WireGuard preference
|
- name: (Debian) Install GPG - required to add wireguard key
|
||||||
copy:
|
|
||||||
src: debian/etc/apt/preferences.d/limit-unstable
|
|
||||||
dest: /etc/apt/preferences.d/limit-unstable
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
mode: 0644
|
|
||||||
tags:
|
|
||||||
- wg-install
|
|
||||||
|
|
||||||
- name: Install GPG - required to add wireguard key
|
|
||||||
apt:
|
apt:
|
||||||
name: gnupg
|
name: gnupg
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Add WireGuard key
|
- name: (Debian) Add WireGuard repository on buster or earlier
|
||||||
apt_key:
|
|
||||||
keyserver: "keyserver.ubuntu.com"
|
|
||||||
id: "8B48AD6246925553"
|
|
||||||
state: present
|
|
||||||
tags:
|
|
||||||
- wg-install
|
|
||||||
|
|
||||||
- name: Add WireGuard repository
|
|
||||||
apt_repository:
|
apt_repository:
|
||||||
repo: "deb http://deb.debian.org/debian/ unstable main"
|
repo: "deb http://deb.debian.org/debian buster-backports main"
|
||||||
state: present
|
state: present
|
||||||
update_cache: yes
|
update_cache: yes
|
||||||
|
when: ansible_distribution_version | int <= 10
|
||||||
tags:
|
tags:
|
||||||
- wg-install
|
- wg-install
|
||||||
|
|
||||||
- name: Get architecture
|
- name: (Debian) Get architecture
|
||||||
shell: dpkg --print-architecture
|
command: "dpkg --print-architecture"
|
||||||
register: dpkg_arch
|
register: dpkg_arch
|
||||||
changed_when: False
|
changed_when: False
|
||||||
|
|
||||||
- name: 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-{{ dpkg_arch.stdout }}"
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
|
- name: (Debian) Install wireguard packages
|
||||||
|
apt:
|
||||||
|
name:
|
||||||
|
- "wireguard-dkms"
|
||||||
|
- "wireguard-tools"
|
||||||
|
state: present
|
||||||
|
tags:
|
||||||
|
- wg-install
|
||||||
|
|
|
@ -1,8 +1,17 @@
|
||||||
---
|
---
|
||||||
- name: Add wireguard COPR
|
- name: (Fedora) Add wireguard COPR
|
||||||
yum_repository:
|
yum_repository:
|
||||||
name: "jdoss-wireguard"
|
name: "jdoss-wireguard"
|
||||||
description: "Copr repo for wireguard owned by jdoss"
|
description: "Copr repo for wireguard owned by jdoss"
|
||||||
baseurl: "https://copr-be.cloud.fedoraproject.org/results/jdoss/wireguard/fedora-$releasever-$basearch/"
|
baseurl: "https://copr-be.cloud.fedoraproject.org/results/jdoss/wireguard/fedora-$releasever-$basearch/"
|
||||||
gpgkey: "https://copr-be.cloud.fedoraproject.org/results/jdoss/wireguard/pubkey.gpg"
|
gpgkey: "https://copr-be.cloud.fedoraproject.org/results/jdoss/wireguard/pubkey.gpg"
|
||||||
gpgcheck: yes
|
gpgcheck: yes
|
||||||
|
|
||||||
|
- name: (Fedora) Install wireguard packages
|
||||||
|
yum:
|
||||||
|
name:
|
||||||
|
- "wireguard-dkms"
|
||||||
|
- "wireguard-tools"
|
||||||
|
state: present
|
||||||
|
tags:
|
||||||
|
- wg-install
|
||||||
|
|
|
@ -1,26 +1,48 @@
|
||||||
---
|
---
|
||||||
- name: Update APT package cache
|
- name: (Ubuntu) Update APT package cache
|
||||||
apt:
|
apt:
|
||||||
update_cache: true
|
update_cache: "{{ wireguard_ubuntu_update_cache }}"
|
||||||
cache_valid_time: 3600
|
cache_valid_time: "{{ wireguard_ubuntu_cache_valid_time }}"
|
||||||
tags:
|
tags:
|
||||||
- wg-install
|
- wg-install
|
||||||
|
|
||||||
- name: Install required packages
|
- block:
|
||||||
package:
|
- name: (Ubuntu) Install support packages needed for Wireguard (for Ubuntu < 19.10)
|
||||||
name: "{{ packages }}"
|
package:
|
||||||
state: present
|
name: "{{ packages }}"
|
||||||
vars:
|
state: present
|
||||||
packages:
|
vars:
|
||||||
- software-properties-common
|
packages:
|
||||||
- linux-headers-{{ ansible_kernel }}
|
- software-properties-common
|
||||||
tags:
|
- linux-headers-{{ ansible_kernel }}
|
||||||
- wg-install
|
tags:
|
||||||
|
- wg-install
|
||||||
|
|
||||||
- name: Add WireGuard repository
|
- name: (Ubuntu) Add WireGuard repository (for Ubuntu < 19.10)
|
||||||
apt_repository:
|
apt_repository:
|
||||||
repo: "ppa:wireguard/wireguard"
|
repo: "ppa:wireguard/wireguard"
|
||||||
state: present
|
state: present
|
||||||
update_cache: yes
|
update_cache: yes
|
||||||
tags:
|
tags:
|
||||||
- wg-install
|
- wg-install
|
||||||
|
|
||||||
|
- name: (Ubuntu) Install wireguard packages (for Ubuntu < 19.10)
|
||||||
|
apt:
|
||||||
|
name:
|
||||||
|
- "wireguard-dkms"
|
||||||
|
- "wireguard-tools"
|
||||||
|
state: present
|
||||||
|
tags:
|
||||||
|
- wg-install
|
||||||
|
when:
|
||||||
|
- ansible_lsb.major_release is version('19.10', '<')
|
||||||
|
|
||||||
|
- block:
|
||||||
|
- name: (Ubuntu) Install wireguard-tools package (for Ubuntu > 19.04)
|
||||||
|
apt:
|
||||||
|
name: "wireguard-tools"
|
||||||
|
state: present
|
||||||
|
tags:
|
||||||
|
- wg-install
|
||||||
|
when:
|
||||||
|
- ansible_lsb.major_release is version('19.04', '>')
|
||||||
|
|
Reference in a new issue