[CODE] add tasks
This commit is contained in:
parent
54cffa0cdc
commit
1900ac0301
11 changed files with 203 additions and 3 deletions
9
templates/hostfile.j2
Normal file
9
templates/hostfile.j2
Normal file
|
@ -0,0 +1,9 @@
|
|||
{% if tinc_public_addr is defined %}
|
||||
Address = {{ tinc_public_addr }}
|
||||
{% endif %}
|
||||
Subnet = {{ tinc_client_ip }}/32
|
||||
{% if tinc_client_ip == tinc_remote_nets[0].gateway %}
|
||||
Subnet = {{ tinc_remote_nets[0].net_cidr }}
|
||||
{% endif %}
|
||||
|
||||
{% include tinc_tmp_pubkey %}
|
15
templates/tinc-down.j2
Normal file
15
templates/tinc-down.j2
Normal file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
|
||||
{% if ansible_hostname == 'hetzner-01' %}
|
||||
/sbin/ifconfig $INTERFACE down
|
||||
/usr/sbin/ip rule del to {{ tinc_remote_nets[0].net_cidr }} table 5
|
||||
|
||||
{% elif ansible_hostname == 'RaspiBeyerstedt' %}
|
||||
/sbin/ifconfig $INTERFACE down
|
||||
/bin/ip route del {{ tinc_remote_nets[0].net_cidr }} dev eth0
|
||||
|
||||
{% elif ansible_hostname == 'Magrathea' %}
|
||||
/sbin/ifconfig $INTERFACE down
|
||||
/sbin/route -n delete -net {{ tinc_remote_nets[0].net_cidr }} {{ tinc_remote_nets[0].gateway }}
|
||||
|
||||
{% endif %}
|
23
templates/tinc-up.j2
Normal file
23
templates/tinc-up.j2
Normal file
|
@ -0,0 +1,23 @@
|
|||
#!/bin/sh
|
||||
|
||||
{% if ansible_hostname == 'hetzner-01' %}
|
||||
/sbin/ifconfig $INTERFACE {{ tinc_client_ip | ipaddr('address') }} netmask 255.255.255.0
|
||||
|
||||
/usr/sbin/ip rule add to {{ tinc_remote_nets[0].net_cidr }} table 5
|
||||
/usr/sbin/ip route add {{ tinc_remote_nets[0].net_cidr }} via {{ tinc_remote_nets[0].gateway }} dev {{ tinc_vpn_id }} table 5
|
||||
|
||||
{% elif ansible_hostname == 'RaspiBeyerstedt' %}
|
||||
/sbin/ifconfig $INTERFACE {{ tinc_client_ip | ipaddr('address') }} netmask 255.255.255.0
|
||||
|
||||
/bin/bash -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
|
||||
/bin/ip route add {{ tinc_remote_nets[0].net_cidr }} dev eth0
|
||||
|
||||
iptables -t nat -A POSTROUTING -o eth0 -s {{ tinc_vpn_net }} -j MASQUERADE
|
||||
|
||||
{% elif ansible_hostname == 'Magrathea' %}
|
||||
# only a single endpoint works, because tun interface is p2p
|
||||
/sbin/ifconfig tun0 inet {{ tinc_client_ip | ipaddr('address') }} {{ tinc_remote_nets[0].gateway }} up netmast 255.255.255.0
|
||||
|
||||
/sbin/route -n add -net {{ tinc_remote_nets[0].net_cidr }} {{ tinc_remote_nets[0].gateway }}
|
||||
|
||||
{% endif %}
|
8
templates/tinc.conf.j2
Normal file
8
templates/tinc.conf.j2
Normal file
|
@ -0,0 +1,8 @@
|
|||
Name = {{ ansible_hostname }}
|
||||
{% if (override_os_family is defined) | ternary(override_os_family,ansible_os_family) != 'Darwin' %}
|
||||
Device = /dev/net/tun
|
||||
{% endif %}
|
||||
{% if ansible_hostname != tinc_central_host %}
|
||||
ConnectTo = {{ tinc_central_host }}
|
||||
{% endif %}
|
||||
AddressFamily = any
|
Loading…
Add table
Add a link
Reference in a new issue