summaryrefslogtreecommitdiff
path: root/roles
diff options
context:
space:
mode:
Diffstat (limited to 'roles')
-rw-r--r--roles/tinc/defaults/main.yml1
-rw-r--r--roles/tinc/handlers/main.yml7
-rw-r--r--roles/tinc/tasks/tinc.yml11
-rwxr-xr-xroles/tinc/templates/tinc-up.j24
4 files changed, 21 insertions, 2 deletions
diff --git a/roles/tinc/defaults/main.yml b/roles/tinc/defaults/main.yml
new file mode 100644
index 0000000..41ec8a3
--- /dev/null
+++ b/roles/tinc/defaults/main.yml
@@ -0,0 +1 @@
+tinc_netname: tn_int
diff --git a/roles/tinc/handlers/main.yml b/roles/tinc/handlers/main.yml
new file mode 100644
index 0000000..fadb8d5
--- /dev/null
+++ b/roles/tinc/handlers/main.yml
@@ -0,0 +1,7 @@
+---
+# handlers file for uvok_tinc
+- name: Apply Tinc config
+ listen: configure tinc
+ service:
+ name: "tinc@{{ tinc_netname }}"
+ state: restarted
diff --git a/roles/tinc/tasks/tinc.yml b/roles/tinc/tasks/tinc.yml
index 2673a59..a76ad8e 100644
--- a/roles/tinc/tasks/tinc.yml
+++ b/roles/tinc/tasks/tinc.yml
@@ -8,14 +8,16 @@
template:
src: tinc.conf.j2
dest: /etc/tinc/tn_int/tinc.conf
- mode: '0750'
+ mode: '0640'
tags:
- tconfig
+ notify: configure bird
- name: Install tinc-up template
template:
src: tinc-up.j2
dest: /etc/tinc/tn_int/tinc-up
mode: '0740'
+ notify: configure bird
tags:
- tconfig
- name: Copy remaining files
@@ -25,6 +27,7 @@
archive: false
recursive: true
times: true
+ notify: configure bird
- name: Make scripts executable
file:
path: "/etc/tinc/tn_int/{{ item }}"
@@ -33,3 +36,9 @@
- tinc-down
tags:
- exec
+- name: Ensure tinc is enabled
+ service:
+ name: "tinc@{{ tinc_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 8c26aa9..92aa782 100755
--- a/roles/tinc/templates/tinc-up.j2
+++ b/roles/tinc/templates/tinc-up.j2
@@ -1,7 +1,9 @@
#!/bin/sh
ip link set $INTERFACE up
ip -6 addr flush dev $INTERFACE
-ip addr add {{ tinc.address }} dev $INTERFACE
+{% for addr in tinc.address %}
+ip addr add {{ addr }} dev $INTERFACE
+{% endfor %}
{% if tinc.extra_up is defined %}
{% for cmd in tinc.extra_up %}
{{ cmd }}