Add ability to deploy matrix client from ansible

- add client_matrix.yml play
- add new ios.conf template
- update main.yml task to include matrix.conf template deploy and tags.
pull/1/head
jowj 4 years ago
parent 1ea0ab8437
commit ec8ea32089

@ -0,0 +1,8 @@
---
- name: generate ios client config
hosts: dev #localhost
tasks:
- debug: msg="generate phone config"
roles:
- { name: wg_vpn }

@ -32,3 +32,9 @@
- name: Start wireguard
service: name=wg-quick@wg0.service enabled=yes state=started
- name: Create matrix.conf file in ~/wireguard/.
template: src=ios.conf dest=/etc/wireguard/ owner=root mode=0600
tags:
- clients
- client_matrix

@ -1,26 +1,9 @@
[Interface]
PrivateKey = {{ wireguard_clients['matrix']['privkey'] }}
Address = {{ wireguard_vpn_network | ipsubnet(32, client.offset) }}
PrivateKey = {{ wireguard_clients[0]['privkey'] }}
Address = {{ wireguard_vpn_network | ipsubnet(32, wireguard_clients[0]['offset']) }}
DNS = 1.1.1.1
[Peer]
PublicKey = {{ wireguard_server_pubkey }}
Endpoint = vpn.awful.club:51820
AllowedIPs = 0.0.0.0/0
{% for client in wireguard_clients %}
[Peer]
# {{ client.name }}
PublicKey = {{ client.pubkey }}
{#
We want the Address field here to be an IP address
withOUT the whole network in CIDR notation, like 10.0.0.15/32.
If wireguard_vpn_network is a CIDR network like 10.0.0.0/24,
and client.offset is an integer like 15,
this will produce an offset of the start of the network with a /32 CIDR prefix
which in this case will be the desired 10.0.0.15/32.
#}
AllowedIPs = {{ wireguard_vpn_network | ipsubnet(32, client.offset) }}
{% endfor %}

Loading…
Cancel
Save