summaryrefslogtreecommitdiff
path: root/roles/tinc
diff options
context:
space:
mode:
Diffstat (limited to 'roles/tinc')
-rw-r--r--roles/tinc/defaults/main.yml14
-rw-r--r--roles/tinc/handlers/main.yml4
-rw-r--r--roles/tinc/tasks/main.yml4
-rw-r--r--roles/tinc/tasks/tinc.yml2
-rwxr-xr-xroles/tinc/templates/tinc-up.j26
-rw-r--r--roles/tinc/templates/tinc.conf.j28
6 files changed, 23 insertions, 15 deletions
diff --git a/roles/tinc/defaults/main.yml b/roles/tinc/defaults/main.yml
index 64aa1e7..d493ac2 100644
--- a/roles/tinc/defaults/main.yml
+++ b/roles/tinc/defaults/main.yml
@@ -1,3 +1,11 @@
-tinc_netname: tn_int
-tinc:
- configure: false \ No newline at end of file
+tinc_options:
+ configure: false
+ netname: tn_int
+ name: example
+ connections: [example]
+ address:
+ - fe80::/64
+ - 10.0.0.1/32
+ listen_on: any
+ extra_up:
+ - echo configured
diff --git a/roles/tinc/handlers/main.yml b/roles/tinc/handlers/main.yml
index 56b5829..1fa1217 100644
--- a/roles/tinc/handlers/main.yml
+++ b/roles/tinc/handlers/main.yml
@@ -5,7 +5,7 @@
- name: Stop Tinc
listen: configure tinc
service:
- name: "tinc@{{ tinc_netname }}"
+ name: "tinc@{{ tinc_options.netname }}"
state: stopped
- name: Wait
listen: configure tinc
@@ -14,5 +14,5 @@
- name: Start Tinc
listen: configure tinc
service:
- name: "tinc@{{ tinc_netname }}"
+ name: "tinc@{{ tinc_options.netname }}"
state: started
diff --git a/roles/tinc/tasks/main.yml b/roles/tinc/tasks/main.yml
index 4cfc7cd..8a9b44d 100644
--- a/roles/tinc/tasks/main.yml
+++ b/roles/tinc/tasks/main.yml
@@ -8,5 +8,5 @@
import_tasks: tinc.yml
when:
- tinc is defined
- - tinc.configure is defined
- - tinc.configure
+ - tinc_options.configure is defined
+ - tinc_options.configure
diff --git a/roles/tinc/tasks/tinc.yml b/roles/tinc/tasks/tinc.yml
index 7453811..c97c180 100644
--- a/roles/tinc/tasks/tinc.yml
+++ b/roles/tinc/tasks/tinc.yml
@@ -38,7 +38,7 @@
- exec
- name: Ensure tinc is enabled
service:
- name: "tinc@{{ tinc_netname }}"
+ name: "tinc@{{ tinc_options.netname }}"
daemon_reload: true
enabled: true
when: ansible_os_family != "OpenWrt"
diff --git a/roles/tinc/templates/tinc-up.j2 b/roles/tinc/templates/tinc-up.j2
index 92aa782..ea81512 100755
--- a/roles/tinc/templates/tinc-up.j2
+++ b/roles/tinc/templates/tinc-up.j2
@@ -1,11 +1,11 @@
#!/bin/sh
ip link set $INTERFACE up
ip -6 addr flush dev $INTERFACE
-{% for addr in tinc.address %}
+{% for addr in tinc_options.address %}
ip addr add {{ addr }} dev $INTERFACE
{% endfor %}
-{% if tinc.extra_up is defined %}
-{% for cmd in tinc.extra_up %}
+{% if tinc_options.extra_up is defined %}
+{% for cmd in tinc_options.extra_up %}
{{ cmd }}
{% endfor %}
{% endif %}
diff --git a/roles/tinc/templates/tinc.conf.j2 b/roles/tinc/templates/tinc.conf.j2
index b7011e1..aa639ab 100644
--- a/roles/tinc/templates/tinc.conf.j2
+++ b/roles/tinc/templates/tinc.conf.j2
@@ -1,11 +1,11 @@
-Name = {{ tinc.name }}
-{% if tinc.listen_on is defined %}
-AddressFamily = {{ tinc.listen_on }}
+Name = {{ tinc_options.name }}
+{% if tinc_options.listen_on is defined %}
+AddressFamily = {{ tinc_options.listen_on }}
{% else %}
AddressFamily = ipv6
{% endif %}
Interface = tn_int
Mode = switch
-{% for conn in tinc.connections %}
+{% for conn in tinc_options.connections %}
ConnectTo = {{ conn }}
{% endfor %}