From 9c2c43730a0008eae2cb9459b3a180b8dae07d33 Mon Sep 17 00:00:00 2001 From: Thomas von Dein Date: Tue, 12 Nov 2024 19:09:20 +0100 Subject: [PATCH] made a little progress, but networking still fails --- Makefile | 11 +++++++++-- debug.yaml | 7 +++++++ group_vars/all/all.yaml | 3 ++- roles/network/tasks/main.yaml | 18 +++++++++++++----- roles/pubnix/tasks/main.yaml | 6 +++++- 5 files changed, 36 insertions(+), 9 deletions(-) create mode 100644 debug.yaml diff --git a/Makefile b/Makefile index a394978..3c1d8ae 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: all deploy check clean create +.PHONY: all deploy check clean create debug TOKEN = $(shell ansible-vault decrypt --vault-password-file \ ~/.config/ansible/hcloud.secret --output - group_vars/all/vars.yaml | cut -d' ' -f2) @@ -10,16 +10,23 @@ CREATE_COMMAND = ansible-playbook create.yaml -i inventory DEPLOY_COMMAND = ansible-playbook deploy.yaml -i inventory CLEAN_COMMAND = ansible-playbook cleanup.yaml -i inventory HOSTS_COMMAND = ansible-playbook knownhosts.yaml -i inventory +DEBUG_COMMAND = ansible-playbook debug.yaml -i inventory ENV = HCLOUD_TOKEN="$(TOKEN)" SNAPSHOT="$(SNAPSHOT)" ANSIBLE_VERBOSITY=$(verbose) +debug: + $(ENV) $(DEBUG_COMMAND) + create: $(ENV) $(CREATE_COMMAND) hosts: $(ENV) $(HOSTS_COMMAND) -deploy: create +all: create + $(ENV) $(DEPLOY_COMMAND) + +deploy: $(ENV) $(DEPLOY_COMMAND) clean: diff --git a/debug.yaml b/debug.yaml new file mode 100644 index 0000000..0dbe3e3 --- /dev/null +++ b/debug.yaml @@ -0,0 +1,7 @@ +--- +- name: DEBUGGING ROLES + hosts: running + gather_facts: true + user: root + roles: + - role: network diff --git a/group_vars/all/all.yaml b/group_vars/all/all.yaml index a14a01c..67d37c6 100644 --- a/group_vars/all/all.yaml +++ b/group_vars/all/all.yaml @@ -20,4 +20,5 @@ ssh_keys: - scip@pixel8 jails: - pubnix: 10.1.1.1 + pubnix: + octet: 2 diff --git a/roles/network/tasks/main.yaml b/roles/network/tasks/main.yaml index d483141..94f5a32 100644 --- a/roles/network/tasks/main.yaml +++ b/roles/network/tasks/main.yaml @@ -1,14 +1,22 @@ --- -- name: Add lo1 interface +- name: Add bridge interface community.general.sysrc: name: cloned_interfaces state: value_present - value: "lo1" + value: "bridge0" -- name: Name lo1 interface bastille0 +- name: Setup bridge interface community.general.sysrc: - name: ifconfig_lo1_name - value: "bastille0" + name: ifconfig_bridge0 + state: value_present + value: "up" notify: netif cloneup +- name: Setup bridge interface ipv6 + community.general.sysrc: + name: ifconfig_bridge0_ipv6 + state: value_present + value: "inet6 auto_linklocal" + notify: netif cloneup + - meta: flush_handlers diff --git a/roles/pubnix/tasks/main.yaml b/roles/pubnix/tasks/main.yaml index abb4a3b..f68aba5 100644 --- a/roles/pubnix/tasks/main.yaml +++ b/roles/pubnix/tasks/main.yaml @@ -28,8 +28,12 @@ extra_zfs_properties: mountpoint: /data/home +- name: determine ipv6 address + shell: ifconfig vtnet0 inet6 | awk '{ if (/2a01/) { sub(/::.$/, "::2", $2); print $2 }}' + register: jailip + - name: create jail - shell: "bastille create {{ role_name }} {{ release }} {{ jails[role_name] }}" + shell: "bastille create -V {{ role_name }} {{ release }} {{ jailip.stdout }}/64 vtnet0" args: creates: /usr/local/bastille/jails/{{ role_name }}