summaryrefslogtreecommitdiffstats
path: root/roles/wireguard/README.md
blob: 7ce5fbe1b5a14c9fcc0ff0ae4c6f932575193070 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Ansible Role: wireguard

This role configures WireGuard VPN connections on the target host.

## Role Variables

- `wireguard_connections` a dictionary of WireGuard connection configurations (default: `{}`).
- `wireguard_autostart_connection` the name of the connection to automatically start on boot (default: `""`).

## Example Configuration

```yaml
wireguard_connections:
  protonvpn-ch-1: |
    [Interface]
    PrivateKey = your_private_key_here
    Address = 10.2.0.2/32
    DNS = 10.2.0.1

    [Peer]
    PublicKey = server_public_key_here
    AllowedIPs = 0.0.0.0/0
    Endpoint = server.endpoint:51820

wireguard_autostart_connection: "protonvpn-ch-1"
```

## Dependencies

This role requires:

- WireGuard kernel module support
- systemd for service management

## Usage

1. Define your WireGuard connection configurations in `wireguard_connections`
1. Optionally set `wireguard_autostart_connection` to auto-start a connection on boot
1. Run the role to deploy configurations and manage services

The role will:

- Install WireGuard packages
- Create configuration files in `/etc/wireguard/`
- Stop all existing connections
- Enable and start the autostart connection (if configured)

## Notes

- Configuration files are backed up before being overwritten
- Only one connection can be set to autostart
- All connections are stopped before starting the autostart connection
- If no autostart connection is configured, no connections will be automatically started