summaryrefslogtreecommitdiff
path: root/roles/install_tayga
diff options
context:
space:
mode:
Diffstat (limited to 'roles/install_tayga')
-rw-r--r--roles/install_tayga/handlers/main.yml5
-rw-r--r--roles/install_tayga/tasks/main.yml25
-rw-r--r--roles/install_tayga/templates/systemd_override.conf.j210
-rw-r--r--roles/install_tayga/templates/tayga.conf.j26
4 files changed, 46 insertions, 0 deletions
diff --git a/roles/install_tayga/handlers/main.yml b/roles/install_tayga/handlers/main.yml
new file mode 100644
index 0000000..38fc10b
--- /dev/null
+++ b/roles/install_tayga/handlers/main.yml
@@ -0,0 +1,5 @@
+---
+- name: restart tayga
+ systemd:
+ name: tayga.service
+ state: restarted
diff --git a/roles/install_tayga/tasks/main.yml b/roles/install_tayga/tasks/main.yml
new file mode 100644
index 0000000..0f38790
--- /dev/null
+++ b/roles/install_tayga/tasks/main.yml
@@ -0,0 +1,25 @@
+---
+- name: install tayga
+ pacman:
+ name: tayga
+ state: present
+
+- name: tayga.conf
+ template:
+ src: tayga.conf.j2
+ dest: /etc/tayga.conf
+ mode: 0644
+ notify: restart tayga
+
+- name: systemd override.conf
+ template:
+ src: systemd_override.conf.j2
+ dest: /etc/systemd/system/tayga.service.d/override.conf
+ mode: 0644
+ notify: restart tayga
+
+- name: start and enable tayga service
+ systemd:
+ name: tayga.service
+ enabled: yes
+ state: started
diff --git a/roles/install_tayga/templates/systemd_override.conf.j2 b/roles/install_tayga/templates/systemd_override.conf.j2
new file mode 100644
index 0000000..a3e7229
--- /dev/null
+++ b/roles/install_tayga/templates/systemd_override.conf.j2
@@ -0,0 +1,10 @@
+[Service]
+ExecStart=
+ExecStartPre=/usr/bin/tayga --mktun --config /etc/tayga.conf
+ExecStartPre=/usr/bin/ip link set nat64 up
+ExecStartPre=/usr/bin/ip addr replace {{ tayga_ipv4 }}/32 dev nat64
+ExecStartPre=/usr/bin/ip addr replace 2a03:2260:1016::64/128 dev nat64
+ExecStartPre=/usr/bin/ip route replace {{ tayga_pool }} dev nat64 table ffmyk
+ExecStartPre=/usr/bin/ip -6 route replace 64:ff9b::/96 dev nat64 table ffmyk
+ExecStart=/usr/bin/tayga --nodetach --config /etc/tayga.conf
+Restart=always
diff --git a/roles/install_tayga/templates/tayga.conf.j2 b/roles/install_tayga/templates/tayga.conf.j2
new file mode 100644
index 0000000..8606dcb
--- /dev/null
+++ b/roles/install_tayga/templates/tayga.conf.j2
@@ -0,0 +1,6 @@
+tun-device nat64
+ipv4-addr {{ tayga_ipv4 }}
+ipv6-addr 2a03:2260:1016::64
+prefix 64:ff9b::/96
+dynamic-pool {{ tayga_pool }}
+data-dir /var/db/tayga