This repository has been archived on 2023-12-29. You can view files and clone it, but cannot push or open issues or pull requests.
pi-ansible/roles/docker_services/tasks/services/wireguard.yml

38 lines
986 B
YAML
Raw Normal View History

2022-12-22 19:18:27 +00:00
# vim: ft=yaml.ansible
2022-12-22 16:58:48 +00:00
---
- name: Create Wireguard volume directory
2023-03-22 18:31:21 +00:00
ansible.builtin.file:
2022-12-22 16:58:48 +00:00
name: "{{ services.wireguard.volume }}"
2022-12-23 14:54:29 +00:00
owner: root
2022-12-22 16:58:48 +00:00
mode: u=rwx,g=rx,o=rx
state: directory
- name: Create Docker network for Wireguard
2023-03-22 18:31:21 +00:00
community.docker.docker_network:
name: wireguard
state: present
2022-12-22 16:58:48 +00:00
- name: Deploy Wireguard Docker container
2023-03-22 18:31:21 +00:00
community.docker.docker_container:
2022-12-22 16:58:48 +00:00
name: wireguard
2023-01-03 21:30:22 +00:00
image: linuxserver/wireguard:{{ services.wireguard.version }}
2023-01-14 18:25:13 +00:00
restart_policy: always
networks:
- name: wireguard
2022-12-22 16:58:48 +00:00
env:
SERVERURL: "{{ services.wireguard.domain }}"
2022-12-28 17:24:27 +00:00
SERVERPORT: '51820'
2022-12-22 16:58:48 +00:00
PEERS: "{{ secrets.wireguard.peers }}"
PEERDNS: auto
TZ: "{{ timezone }}"
volumes:
- "{{ services.wireguard.volume }}:/config:rw"
- /lib/modules:/lib/modules:rw
published_ports:
2023-01-03 21:30:22 +00:00
- 51820:51820/udp
2022-12-22 16:58:48 +00:00
capabilities:
- net_admin
- sys_module
sysctls:
net.ipv4.conf.all.src_valid_mark: 1