get values of machine cidr by referencing them in group vars

This commit is contained in:
max.mehl 2022-03-03 09:04:00 +01:00
parent 7a477c31f1
commit 4e61c41fbd
No known key found for this signature in database
GPG Key ID: 2704E4AB371E2E92
3 changed files with 11 additions and 4 deletions

View File

@ -11,6 +11,7 @@ cidrs:
## 10.200.16.1 to 10.200.31.254
## 4,096 usable IP addresses
humans:
name: humans
parent: fsfe
cidr: 10.200.16.0/20
@ -18,6 +19,7 @@ cidrs:
### 10.200.16.1 to 10.200.19.254
### 1,024 usable IP addresses
admins:
name: admins
parent: humans
cidr: 10.200.16.0/22
@ -25,6 +27,7 @@ cidrs:
### 10.200.20.1 to 10.200.23.254
### 1,024 usable IP addresses
others:
name: others
parent: humans
cidr: 10.200.20.0/22
@ -32,9 +35,14 @@ cidrs:
## 10.200.64.1 to 10.200.127.254
## with 16,384 usable IP addresses
machines:
name: machines
parent: fsfe
cidr: 10.200.64.0/18
# key of the CIDR you want to use for the client role,
# so automatically configured peers (typically VMs)
machine_cidr: machines
manual_peers:
linus:
cidr: admins
@ -54,4 +62,3 @@ manual_peers:
# - { "cidr": "others", "name": "fani", "admin": "false" }
# machines, e.g.
# - { "cidr": "machines", "name": "cont1-plutex", "admin": "false" }
machine_cidr: { "name": "machines", "cidr": "10.200.64.0/18", "admin": "false" }

View File

@ -75,8 +75,8 @@
shell: |
innernet-server add-peer "{{ network_name }}" \
--name "{{ innernet_client }}" \
--cidr "{{ machine_cidr.name }}" \
--admin "{{ machine_cidr.admin }}" \
--cidr "{{ cidrs[machine_cidr]['cidr'] }}" \
--admin "false" \
--save-config "/root/{{ innernet_client }}.toml" \
--invite-expires "14d" \
--auto-ip \

View File

@ -68,7 +68,7 @@
tags: [cidr]
shell: |
innernet-server add-cidr "{{ network_name }}" \
--name "{{ item.key }}" \
--name "{{ item.name }}" \
--parent "{{ item.value.parent }}" \
--cidr "{{ item.value.cidr }}" \
--yes