Include needed scripts

This commit is contained in:
nemunaire 2023-03-15 22:16:43 +01:00
parent 35a6017f7d
commit 8ead2bc0fe
4 changed files with 35 additions and 1 deletions

8
files/wg-sync.sh Normal file
View File

@ -0,0 +1,8 @@
#!/bin/sh
{
cat /etc/wg-adlin.conf
curl -s https://adlin.nemunai.re/api/wg.conf
} > /tmp/wg-adlin.conf &&
wg addconf wg-adlin /tmp/wg-adlin.conf

View File

@ -94,7 +94,7 @@
name: "{{ ctr_name }}"
container_command: |
echo nameserver 192.168.0.254 > /etc/resolv.conf;
apk add --no-cache wireguard-tools-wg nftables;
apk add --no-cache curl wireguard-tools-wg nftables;
state: started
- name: Create symlink for service

View File

@ -15,11 +15,29 @@
state: directory
# 3. Install others scripts
- name: configure wg-adlin
copy:
src: "/etc/wireguard/wg-adlin.conf"
dest: "/var/lib/lxc/{{ ctr_name }}/rootfs/etc/wg-adlin.conf"
remote_src: true
tags:
- wireguard
- name: Copy wg-sync.sh
copy:
src: "wg-sync.sh"
dest: "/var/lib/lxc/{{ ctr_name }}/rootfs/root/wg-sync.sh"
mode: 0755
tags:
- wireguard
- name: Retrieve clean-wg.sh
get_url:
url: https://git.nemunai.re/teach/adlin/raw/branch/master/token-validator/clean-wg.sh
dest: "/var/lib/lxc/{{ ctr_name }}/rootfs/usr/sbin/clean-wg.sh"
mode: 0755
tags:
- wireguard
- name: Add update-adlin script
template:

View File

@ -4,6 +4,8 @@
name:
- wireguard-tools-wg
state: present
tags:
- wireguard
- name: Enable IPv6 forwarding
ansible.posix.sysctl:
@ -15,14 +17,20 @@
file:
path: /etc/wireguard
state: directory
tags:
- wireguard
- name: configure wg-adlin
template:
src: "wg.conf.j2"
dest: "/etc/wireguard/wg-adlin.conf"
tags:
- wireguard
- name: enable wg-adlin
template:
src: networking.j2
dest: "/etc/network/interfaces.d/wg-adlin"
notify: restart networking
tags:
- wireguard