Closed holmesb closed 5 years ago
@holmesb That route will definitely not work but you COULD do something like below:
dns_servers:
- 192.168.250.10
- 192.168.250.11
netplan_configuration:
network:
version: 2
ethernets: "{{ nics }}"
nics:
eth0:
addresses:
- 192.168.250.10
gateway4: 192.168.250.1
nameservers:
search: "{{ search_domains }}"
addresses: "{{ dns_servers }}"
search_domains:
- test.example.org
- example.org
Hopefully this will help you a bit. Let me know if you have any additional questions.
I've changed to:
netplan_configuration:
network:
version: 2
ethernets:
nic_device:
addresses:
- "{{ primary_ip }}{{ primary_subnet_mask }}"
gateway4: "{{ primary_gateway }}"
...
nic_device: eth0
And your template to:
ethernets:
{{ nic_device|indent(4, true) }}:
{{ netplan_configuration['network']['ethernets']['nic_device']|to_nice_yaml|indent(6, true) }}
Many thanks
@holmesb Glad you were able to get it sorted out!
Any ideas how to parameterise the network device name? Eg, I have:
I want:
But this errors:
Error in network definition: Invalid name '{{ nic_device }}