forked from ccollicutt/ansible-tinc
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
138 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
|
||
#- name: Load common vars | ||
# include_vars: > | ||
# common.yml | ||
|
||
- name: Load os dependent vars | ||
include_vars: "{{ item }}" | ||
with_first_found: | ||
- "os_{{ os_family }}.yml" | ||
- "os_{{ ansible_os_family }}.yml" | ||
- "os_default.yml" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
|
||
os_shell: '/system/bin/sh' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
|
||
os_shell: '/bin/sh' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!{{ os_shell }} | ||
|
||
## variable provided by tinc | ||
#NETNAME= | ||
#NAME= | ||
#DEVICE= | ||
#INTERFACE= | ||
#NODE= | ||
#REMOTEADDRESS= | ||
#REMOTEPORT= | ||
#SUBNET= | ||
#WEIGHT= | ||
|
||
## our config variables | ||
VPN_IPADDR="{{ tinc_ip }}" | ||
VPN_HOSTNAME="{{ tinc_hostname }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
#!/bin/sh | ||
#!{{ os_shell }} | ||
# | ||
# {{ ansible_managed }} | ||
|
||
SN="host-down" | ||
# start user handler scripts | ||
# /etc/tinc/<handler>.<vpn_name> | ||
# /etc/tinc/<handler> | ||
# stop processing if script returns 99 | ||
SN='host-down' | ||
DN=`dirname "$0"` | ||
DN=`dirname "$DN"` | ||
[ -e $DN/$SN.{{ vpn_name }} ] && $DN/$SN.{{ vpn_name }} "$@" | ||
[ "$?" = "99" ] && exit 0 | ||
[ -e $DN/$SN ] && $DN/$SN "$@" | ||
[ "$?" = "99" ] && exit 0 | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
#!/bin/sh | ||
#!{{ os_shell }} | ||
# | ||
# {{ ansible_managed }} | ||
|
||
SN="host-up" | ||
# start user handler scripts | ||
# /etc/tinc/<handler>.<vpn_name> | ||
# /etc/tinc/<handler> | ||
# stop processing if script returns 99 | ||
SN='host-up' | ||
DN=`dirname "$0"` | ||
DN=`dirname "$DN"` | ||
[ -e $DN/$SN.{{ vpn_name }} ] && $DN/$SN.{{ vpn_name }} "$@" | ||
[ "$?" = "99" ] && exit 0 | ||
[ -e $DN/$SN ] && $DN/$SN "$@" | ||
[ "$?" = "99" ] && exit 0 | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,20 @@ | ||
#!/bin/sh | ||
#!{{ os_shell }} | ||
# | ||
# {{ ansible_managed }} | ||
|
||
SN="subnet-down" | ||
# start user handler scripts | ||
# /etc/tinc/<handler>.<vpn_name> | ||
# /etc/tinc/<handler> | ||
# stop processing if script returns 99 | ||
SN='subnet-down' | ||
DN=`dirname "$0"` | ||
DN=`dirname "$DN"` | ||
[ -e $DN/$SN.{{ vpn_name }} ] && $DN/$SN.{{ vpn_name }} "$@" | ||
[ "$?" = "99" ] && exit 0 | ||
[ -e $DN/$SN ] && $DN/$SN "$@" | ||
[ "$?" = "99" ] && exit 0 | ||
|
||
# remove selective route | ||
ip route del "$SUBNET" via "{{ tinc_ip }}" dev "$INTERFACE" | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,20 @@ | ||
#!/bin/sh | ||
#!{{ os_shell }} | ||
# | ||
# {{ ansible_managed }} | ||
|
||
SN="subnet-up" | ||
# start user handler scripts | ||
# /etc/tinc/<handler>.<vpn_name> | ||
# /etc/tinc/<handler> | ||
# stop processing if script returns 99 | ||
SN='subnet-up' | ||
DN=`dirname "$0"` | ||
DN=`dirname "$DN"` | ||
[ -e $DN/$SN.{{ vpn_name }} ] && $DN/$SN.{{ vpn_name }} "$@" | ||
[ "$?" = "99" ] && exit 0 | ||
[ -e $DN/$SN ] && $DN/$SN "$@" | ||
[ "$?" = "99" ] && exit 0 | ||
|
||
# add selective route | ||
ip route add "$SUBNET" via "{{ tinc_ip }}" dev "$INTERFACE" | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
#!/bin/sh | ||
#!{{ os_shell }} | ||
# | ||
# {{ ansible_managed }} | ||
|
||
ifconfig $INTERFACE down | ||
|
||
SN="tinc-down" | ||
# start user handler scripts | ||
# /etc/tinc/<handler>.<vpn_name> | ||
# /etc/tinc/<handler> | ||
# stop processing if script returns 99 | ||
SN='tinc-down' | ||
DN=`dirname "$0"` | ||
DN=`dirname "$DN"` | ||
[ -e $DN/$SN.{{ vpn_name }} ] && $DN/$SN.{{ vpn_name }} "$@" | ||
[ "$?" = "99" ] && exit 0 | ||
[ -e $DN/$SN ] && $DN/$SN "$@" | ||
[ "$?" = "99" ] && exit 0 | ||
|
||
ifconfig $INTERFACE down | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
|
||
#dependencies: | ||
# - role: tinc-common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
|
||
- name: Get distribution info | ||
set_fact: > | ||
os_distribution="{ansible_distribution}" | ||
os_family="{ansible_os_family}" | ||
os_pkg_mgr="{ansible_pkg_mgr}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters