Initial role-data
parent
f2c86dc22d
commit
248a3c08b8
@ -0,0 +1,12 @@
|
|||||||
|
wireguard_ipv6_converter:
|
||||||
|
version: latest
|
||||||
|
|
||||||
|
# see https://github.com/Ruakij/wg-ipv6-converter#31-environment
|
||||||
|
setup:
|
||||||
|
interface: wt0
|
||||||
|
ipv6_format: ""
|
||||||
|
filter_prefix: 100.100
|
||||||
|
recheck_interval: 60s
|
||||||
|
|
||||||
|
service:
|
||||||
|
bindTo: netbird.service
|
@ -0,0 +1,9 @@
|
|||||||
|
- name: Get architecture
|
||||||
|
set_fact:
|
||||||
|
arch: {{ 'amd64' if ansible_architecture == 'x86_64' elif 'amd64' if ansible_architecture == 'aarch64' }}
|
||||||
|
|
||||||
|
- name: Download binary
|
||||||
|
get_url:
|
||||||
|
url: https://github.com/Ruakij/wg-ipv6-converter/releases/download/{{ wireguard_ipv6_converter.version }}/wg-ipv6-converter_{{ arch }}
|
||||||
|
dest: /usr/bin/local/wg-ipv6-converter
|
||||||
|
mode: "744"
|
@ -0,0 +1,3 @@
|
|||||||
|
- import_tasks: ./deploy.yml
|
||||||
|
|
||||||
|
- import_tasks: ./setup-service.yml
|
@ -0,0 +1,12 @@
|
|||||||
|
- name: Deploy service
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: wg-ipv6-conv.service.jinja2
|
||||||
|
dest: /etc/systemd/system/wg-ipv6-converter_{{ wireguard_ipv6_converter.setup.interface }}.service
|
||||||
|
register: service-file
|
||||||
|
|
||||||
|
- name: Enable service
|
||||||
|
ansible.builtin.service:
|
||||||
|
name: wg-ipv6-converter_{{ wireguard_ipv6_converter.setup.interface }}
|
||||||
|
state: '{{ 'restarted' if service-file.changed else 'started' }}'
|
||||||
|
enabled: true
|
||||||
|
|
@ -0,0 +1,23 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=WireGuard IPv6 converter for {{ wireguard_ipv6_converter.setup.interface }}
|
||||||
|
{% if wireguard_ipv6_converter.service.bindTo is defined %}
|
||||||
|
BindsTo={{ wireguard_ipv6_converter.service.bindTo }}
|
||||||
|
After={{ wireguard_ipv6_converter.service.bindTo }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
{% if wireguard_ipv6_converter.service.bindTo is defined %}
|
||||||
|
ExecStartPre=/bin/sleep 10
|
||||||
|
{% endif %}
|
||||||
|
ExecStart=/usr/local/bin/wg-ipv6-converter
|
||||||
|
Restart=always
|
||||||
|
RestartSec=30
|
||||||
|
|
||||||
|
Environment="INTERFACE={{ wireguard_ipv6_converter.setup.interface }}"
|
||||||
|
Environment="IPV6_FORMAT={{ wireguard_ipv6_converter.setup.ipv6_format }}"
|
||||||
|
Environment="FILTER_PREFIX={{ wireguard_ipv6_converter.setup.filter_prefix }}"
|
||||||
|
Environment="RECHECK_INTERVAL={{ wireguard_ipv6_converter.setup.recheck_interval }}"
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
Loading…
Reference in New Issue