fixed ip variables, now using inventory vars

This commit is contained in:
Thomas von Dein 2024-11-26 13:09:26 +01:00
parent fe04b3fe87
commit 158048f51d
4 changed files with 11 additions and 5 deletions

View File

@ -16,6 +16,7 @@ DEPLOY_COMMAND = ansible-playbook deploy.yaml $(OPTIONS)
CLEAN_COMMAND = ansible-playbook cleanup.yaml $(OPTIONS) CLEAN_COMMAND = ansible-playbook cleanup.yaml $(OPTIONS)
HOSTS_COMMAND = ansible-playbook knownhosts.yaml $(OPTIONS) HOSTS_COMMAND = ansible-playbook knownhosts.yaml $(OPTIONS)
DEBUG_COMMAND = ansible-playbook debug.yaml $(OPTIONS) DEBUG_COMMAND = ansible-playbook debug.yaml $(OPTIONS)
SHOW_COMMAND = ansible-inventory -i inventory/hosts.hcloud.yaml --list
ENV = HCLOUD_TOKEN="$(TOKEN)" SNAPSHOT="$(SNAPSHOT)" ANSIBLE_VERBOSITY=$(verbose) ENV = HCLOUD_TOKEN="$(TOKEN)" SNAPSHOT="$(SNAPSHOT)" ANSIBLE_VERBOSITY=$(verbose)
@ -49,3 +50,6 @@ editvars:
showvars: showvars:
ansible-vault decrypt $(VARS) --output - ansible-vault decrypt $(VARS) --output -
showinventory:
$(ENV) $(SHOW_COMMAND)

View File

@ -6,4 +6,3 @@
user: root user: root
roles: roles:
- role: network - role: network
- role: pubnix

View File

@ -5,3 +5,5 @@ status:
groups: groups:
dev: dev:
connect_with: "public_ipv6" connect_with: "public_ipv6"
compose:
server_ipv6: ipv6

View File

@ -1,12 +1,13 @@
--- ---
- name: determine ipv6 address - name: determine ipv6 jail address
shell: ifconfig {{ netif.primary }} inet6 | awk '{ if (/2a01/) { sub(/::.$/, "::2", $2); print $2 }}' shell: echo {{ server_ipv6 }} | sed 's/::1/::2/'
register: jailip register: jailip
- name: determine ipv6 net - name: determine ipv6 net
shell: ifconfig {{ netif.primary }} inet6 | awk '{ if (/2a01/) { sub(/::.$/, "::", $2); print $2"/64" }}' shell: echo '{{ ipv6_network }}/64'
register: jailnet register: jailnet
- name: determine primary ipv6 address - name: determine primary ipv6 address
shell: ifconfig {{ netif.primary }} inet6 | awk '{ if (/2a01/) { print $2 }}' shell: echo {{ server_ipv6 }}
register: primaryip register: primaryip