From ac5dab57336ea1985e840441c04003ce2e862e02 Mon Sep 17 00:00:00 2001 From: mathieui Date: Tue, 5 Jan 2021 18:59:20 +0100 Subject: [PATCH] Add docs, remove useless files --- README.md | 46 ++++++++++++++++++++++++++++++++++++++- templates/nets.boot.j2 | 1 - templates/tinc.conf.j2 | 4 +++- templates/tinc.service.j2 | 11 ---------- 4 files changed, 48 insertions(+), 14 deletions(-) delete mode 100644 templates/nets.boot.j2 delete mode 100644 templates/tinc.service.j2 diff --git a/README.md b/README.md index 3087734..f0cd21e 100644 --- a/README.md +++ b/README.md @@ -2,5 +2,49 @@ Based on https://github.com/thisismitch/ansible-tinc -TODO: documentation +Creates the directory structure for a tinc install: +``` +/etc/tinc/{{netname}}/ +/etc/tinc/{{netname}}/tinc-up +/etc/tinc/{{netname}}/tinc-down +/etc/tinc/{{netname}}/tinc.conf +/etc/tinc/{{netname}}/hosts/ +/etc/tinc/{{netname}}/hosts/{{ inventory_name }} +/etc/tinc/{{netname}}/rsa_key.priv +``` + +The last one is a RSA 4096 private key, it may take a while to generate on low-entropy servers. + +It will also sync the ``playbook_dir/fetch/`` directory into +``/etc/tinc/{{netname}}/hosts/``. + + +# Expected group vars + +* **netname**: Name of the TINC network +* **net_addr**: Address of the network +* **net_cidr**: CIDR of the network (24 for me) +* **default_connect**: Default node name to connect to (empty for a new network) + +Sample group_vars/all file: + +```yaml +--- + +netname: mynetwork +net_addr: 10.11.12.0 +net_cidr: 24 +default_connect: mymachine +``` + +# Expected host vars + +**vpn_ip**: desired VPN internal ip of this host + +``` +[vpn_hosts] +mymachine ansible_host=1.1.1.1 vpn_ip=10.11.12.23 +mymachine2 ansible_host=1.1.2.2 vpn_ip=10.11.12.23 + +``` diff --git a/templates/nets.boot.j2 b/templates/nets.boot.j2 deleted file mode 100644 index bba075b..0000000 --- a/templates/nets.boot.j2 +++ /dev/null @@ -1 +0,0 @@ -{{ netname }} diff --git a/templates/tinc.conf.j2 b/templates/tinc.conf.j2 index 25de566..1bd52cf 100644 --- a/templates/tinc.conf.j2 +++ b/templates/tinc.conf.j2 @@ -1,3 +1,5 @@ Name = {{ inventory_hostname }} Device = /dev/net/tun -ConnectTo = {{ TO PARAMETRIZE }} +{% if default_connect is defined %} +ConnectTo = {{ default_connect }} +{% endif %} diff --git a/templates/tinc.service.j2 b/templates/tinc.service.j2 deleted file mode 100644 index c92b89e..0000000 --- a/templates/tinc.service.j2 +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=tinc vpn -After=network.target - -[Service] -Type=forking -ExecStart=/usr/sbin/tincd -n {{ netname }} -ExecReload=/usr/bin/kill -HUP $MAINPID - -[Install] -WantedBy=multi-user.target