wireguard: clean up
- make variables less clunky - make docker-compose run after wireguard (this seems janky right now)
This commit is contained in:
parent
0c8d18dcce
commit
c70e33e629
@ -45,4 +45,6 @@ escalation_method: doas
|
|||||||
enable_connection: yes
|
enable_connection: yes
|
||||||
|
|
||||||
# use a wireguard network between bastion and fleet host for the reverse proxy
|
# use a wireguard network between bastion and fleet host for the reverse proxy
|
||||||
|
# see roles/wireguard/defaults/main.yml for further config settings
|
||||||
wireguard_services: true
|
wireguard_services: true
|
||||||
|
wireguard_interface: "wg0"
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Services manager with docker-compose
|
Description=Services manager with docker-compose
|
||||||
|
{% if wireguard_services %}
|
||||||
|
Requires=docker.service wg-quick@{{ wireguard_interface }}.service
|
||||||
|
After=docker.service wg-quick@{{ wireguard_interface }}.service
|
||||||
|
{% else %}
|
||||||
Requires=docker.service
|
Requires=docker.service
|
||||||
After=docker.service
|
After=docker.service
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
User=docker
|
User=docker
|
||||||
|
@ -6,10 +6,13 @@
|
|||||||
|
|
||||||
# also see group_vars/all/00-secret-template.yml
|
# also see group_vars/all/00-secret-template.yml
|
||||||
|
|
||||||
|
# this key is defined in group_vars/all/50-vars.yml
|
||||||
|
# it's duplicated here just in case
|
||||||
|
wireguard_interface: "wg0"
|
||||||
|
|
||||||
wireguard:
|
wireguard:
|
||||||
dns_servers:
|
dns_servers:
|
||||||
- "{{ dns_forward }}"
|
- "{{ dns_forward }}"
|
||||||
interface: "wg0"
|
|
||||||
ip:
|
ip:
|
||||||
# cidr range in tunnel
|
# cidr range in tunnel
|
||||||
cidr: "10.66.77.0/24"
|
cidr: "10.66.77.0/24"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
- name: Start wireguard
|
- name: Start wireguard
|
||||||
systemd:
|
systemd:
|
||||||
name: "wg-quick@{{ wireguard.interface }}.service"
|
name: "wg-quick@{{ wireguard_interface }}.service"
|
||||||
enabled: yes
|
enabled: yes
|
||||||
daemon_reload: yes
|
daemon_reload: yes
|
||||||
state: restarted
|
state: restarted
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
- name: Deploy wireguard server config
|
- name: Deploy wireguard server config
|
||||||
template:
|
template:
|
||||||
src: server.conf.j2
|
src: server.conf.j2
|
||||||
dest: "/etc/wireguard/{{ wireguard.interface }}.conf"
|
dest: "/etc/wireguard/{{ wireguard_interface }}.conf"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0600
|
mode: 0600
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
[Interface]
|
[Interface]
|
||||||
Address = {{ hostvars[inventory_hostname]["vpn_ip"] }}/32
|
Address = {{ vpn_ip }}/32
|
||||||
PrivateKey = {{ wireguard_secret.servers[inventory_hostname].priv }}
|
PrivateKey = {{ wireguard_secret.servers[inventory_hostname].priv }}
|
||||||
ListenPort = {{ wireguard.ip.port }}
|
ListenPort = {{ wireguard.ip.port }}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user