From b208937cc9a99544e6fdeb7c15555296aead94a6 Mon Sep 17 00:00:00 2001 From: redxef Date: Mon, 22 Jan 2024 16:34:28 +0100 Subject: [PATCH] Some tooling improvements. --- dev/.gitignore | 1 + dev/config/{lighttpd.conf => lighttpd.conf.tmpl} | 1 + dev/config/wgvirtipd.sh.tmpl | 4 ++++ dev/docker-compose.yaml.tmpl | 3 ++- dev/setup.yaml | 9 +++++++++ 5 files changed, 17 insertions(+), 1 deletion(-) rename dev/config/{lighttpd.conf => lighttpd.conf.tmpl} (64%) create mode 100755 dev/config/wgvirtipd.sh.tmpl diff --git a/dev/.gitignore b/dev/.gitignore index 7837734..acdbf21 100644 --- a/dev/.gitignore +++ b/dev/.gitignore @@ -1,3 +1,4 @@ config/vm*.conf config/vm*.html +config/vm*.sh docker-compose.yaml diff --git a/dev/config/lighttpd.conf b/dev/config/lighttpd.conf.tmpl similarity index 64% rename from dev/config/lighttpd.conf rename to dev/config/lighttpd.conf.tmpl index 26a2f9a..0b825d8 100644 --- a/dev/config/lighttpd.conf +++ b/dev/config/lighttpd.conf.tmpl @@ -1,2 +1,3 @@ server.document-root = "/var/www/" +server.bind = "{{ item.ip }}" server.port = 8080 diff --git a/dev/config/wgvirtipd.sh.tmpl b/dev/config/wgvirtipd.sh.tmpl new file mode 100755 index 0000000..2d70bfc --- /dev/null +++ b/dev/config/wgvirtipd.sh.tmpl @@ -0,0 +1,4 @@ +#!/bin/sh + +wgvirtipd --addr={{ item.ip }}:8082 --link wg0 +exit $? diff --git a/dev/docker-compose.yaml.tmpl b/dev/docker-compose.yaml.tmpl index 39f9bc4..9d28bdd 100644 --- a/dev/docker-compose.yaml.tmpl +++ b/dev/docker-compose.yaml.tmpl @@ -11,8 +11,9 @@ services: - ./config/{{ item.item }}-keepalived.conf:/etc/keepalived/keepalived.conf - ./config/check.sh:/etc/keepalived/check.sh - ./config/master.sh:/etc/keepalived/master.sh - - ./config/lighttpd.conf:/etc/lighttpd/lighttpd.conf + - ./config/{{ item.item }}-lighttpd.conf:/etc/lighttpd/lighttpd.conf - ./config/{{ item.item }}-index.html:/var/www/index.html + - ./config/{{ item.item }}-wgvirtipd.sh:/usr/local/bin/wgvirtipd.sh - ../target/x86_64-unknown-linux-musl/debug:/opt/wgvirtipd networks: - default diff --git a/dev/setup.yaml b/dev/setup.yaml index d5c873a..938e51a 100644 --- a/dev/setup.yaml +++ b/dev/setup.yaml @@ -43,10 +43,19 @@ src: ./config/keepalived.conf.tmpl dest: ./config/{{ item.item }}-keepalived.conf with_items: "{{ keypairs }}" + - template: + src: ./config/lighttpd.conf.tmpl + dest: ./config/{{ item.item }}-lighttpd.conf + with_items: "{{ keypairs }}" - template: src: ./config/index.html.tmpl dest: ./config/{{ item.item }}-index.html with_items: "{{ keypairs }}" + - template: + src: ./config/wgvirtipd.sh.tmpl + dest: ./config/{{ item.item }}-wgvirtipd.sh + mode: 0755 + with_items: "{{ keypairs }}" - template: src: ./docker-compose.yaml.tmpl dest: ./docker-compose.yaml