Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pimvh/wireguard
Ansible role to configure Wireguard
https://github.com/pimvh/wireguard
ansible molecule-tested role vpn wireguard
Last synced: 16 days ago
JSON representation
Ansible role to configure Wireguard
- Host: GitHub
- URL: https://github.com/pimvh/wireguard
- Owner: pimvh
- License: gpl-3.0
- Created: 2024-05-13T21:13:01.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-05-20T18:51:30.000Z (9 months ago)
- Last Synced: 2024-11-20T05:28:04.946Z (3 months ago)
- Topics: ansible, molecule-tested, role, vpn, wireguard
- Language: Jinja
- Homepage:
- Size: 62.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![Molecule test](https://github.com/pimvh/wireguard/actions/workflows/test.yaml/badge.svg)
# Requirements1. Ansible installed:
```
sudo apt install python3
python3 -m ensurepip --upgrade
pip3 install ansible
```2. ansible.utils.ipaddr:
```
pip3 install netaddr
```## Required variables
Set the variables as shown in defined.
```yaml
---
wireguard_server_config_dir: /etc/wireguard
wireguard_client_config_dir: $HOME
wireguard_client_config_storage_host: localhostwireguard_generate_server_keys: false
wireguard_generate_preshared_key: false
wireguard_provision_client: true
wireguard_show: falsewireguard_configure_sysctl: true
wireguard_iffname: "wg0"
wireguard_endpoint: ""
wireguard_range_v4: ""
wireguard_range_v6: ""
wireguard_port: ""
wireguard_dns: ""
wireguard_routed_ips: ""
wireguard_peers: []
# - name: harry
# routed_ips: 0.0.0.0/0, ::/0 # the IPv4/IPv6 addresses you would like to route (if this is not defined wg_routed_ips is used)
# dns: 1.1.1.1, 2606:4700:4700::1111 # the DNS your peer uses when using the VPN (if this is not defined wg_dns is used)
# force: false # can be skipped, whether to force recreate, overwriting keys```
See the argument spec in meta/main.yaml for additional descriptions.
The ansible networking module:
ansible.utils.ipaddr
# Example playbook
```yaml
hosts:
- foo
roles:
- ansible-wireguard```
Please note that this role does not take care of allowing wireguard through the firewall and other iptables/nftables config, as this goes beyond the scope of this role. You have do that manually, or use other roles.
# TLDR - What will happen if I run this
- install wireguard
- generate server config/keys (on remote target)
- generate client config where requested
- save client configs where requested (can be set to any host)
- bring the wg interface up (using systemd)
- show wg config when requested