From bf6f4ae912d3a51a66921b035158e2c178cfd874 Mon Sep 17 00:00:00 2001 From: Astro Date: Sat, 14 Apr 2018 22:31:40 +0200 Subject: [PATCH] upstream.ipv6-tunnel: add ipv6-tunnel-update.sh for upstream2 --- salt-pillar/upstream/upstream2.sls | 18 ++++++++++++++++++ salt/upstream/ipv6-tunnel-update.sh | 3 +++ salt/upstream/ipv6-tunnel.sls | 22 ++++++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 salt/upstream/ipv6-tunnel-update.sh diff --git a/salt-pillar/upstream/upstream2.sls b/salt-pillar/upstream/upstream2.sls index 320219e..48dbe93 100644 --- a/salt-pillar/upstream/upstream2.sls +++ b/salt-pillar/upstream/upstream2.sls @@ -14,3 +14,21 @@ ipv6-tunnel: endpoint: 216.66.80.30 address: 2001:470:1f0a:12b2::2/64 gateway: 2001:470:1f0a:12b2::1 + + tunnelbroker: + tunnel_id: '407181' + username: 'C3D2HQ' + key: | + -----BEGIN PGP MESSAGE----- + + hQEMA2PKcvDMvlKLAQf+MPl9B7V1GfG+ps+cILxxnGA8nx9KN69Zj03T5KVYMWw7 + 6nMfXyhC6ZV3BTVUPqY290SaMP0wa4YjpewypfILoJLQDGV7SQaR8eVVCXQYusXK + M+L1jWr8f+GOCH5BYsX4WS0PhJ0EplSDlbsvT2NiLc7SFGsrLwpfL4jLJJ3ICSif + BbKZy7aovpAXmaeTFaYR7wsclXk7hM94U0uaF9HJK0e9WDFuHuz7dbAXLVFIHFIx + UdrjoA8GfRoCqMLXe9Uce+MPvkJX3m0oAtc68Znw/4ndMm6FIyuUhA/jh+gt4/2B + BXCch68PGnKNiFmRDW+h17ZiAFeobyb960wJBammLNJLAS+adCeoDgJCxXTzZ5Rh + IFEdKAewlFa1RXWn0HhGu7FYoeM+EbuH/ZYW9TOIWYRb3Ol36MPDoRuPEWU/bETG + UQEvc22wrpxOfjIA + =UbJD + -----END PGP MESSAGE----- + diff --git a/salt/upstream/ipv6-tunnel-update.sh b/salt/upstream/ipv6-tunnel-update.sh new file mode 100644 index 000000000..ac82cad --- /dev/null +++ b/salt/upstream/ipv6-tunnel-update.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +curl https://{{ username }}:{{ key }}@ipv4.tunnelbroker.net/nic/update?hostname={{ tunnel_id }} diff --git a/salt/upstream/ipv6-tunnel.sls b/salt/upstream/ipv6-tunnel.sls index 539aecb..0b38368 100644 --- a/salt/upstream/ipv6-tunnel.sls +++ b/salt/upstream/ipv6-tunnel.sls @@ -1,6 +1,9 @@ ifupdown: pkg.installed: [] +curl: + pkg.installed: [] + /etc/systemd/network/ipv6.netdev: file.append: - text: | @@ -27,8 +30,27 @@ ifupdown: [Network] Tunnel=ipv6 +{%- if pillar['ipv6-tunnel'].get('tunnelbroker') -%} +/etc/cron.hourly/ipv6-tunnel-update.sh + file.managed: + - source: salt://upstream/ipv6-tunnel-update.sh + - template: 'jinja' + - mode: 744 + - context: {{ pillar['ipv6-tunnel']['tunnelbroker'] }} + - require: + - pkg: curl + +cron: + service: + - enabled + - running + - watch: + - file: /etc/cron.hourly/ipv6-tunnel-update.sh +{%- endif -%} + systemd-networkd: service: + - enabled - running - watch: - file: /etc/systemd/network/ipv6.netdev