Merge pull request #1072 from JasonYangShadow/issue/922

add DNS fields to multiple managed templates
This commit is contained in:
Jonathon Anderson
2024-02-16 17:24:22 -07:00
committed by GitHub
4 changed files with 32 additions and 0 deletions

View File

@@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add nightly release support. #969
- Add container rename command. #583
- Add container build flags and warn message after container sync. #509
- Add DNS fields to network configuration overlays. #922
### Fixed
- Make Variables.mk consistent with spec file w.r.t. WWPROVISIONDIR, e.g.

View File

@@ -65,6 +65,16 @@ address={{ $netdev.IpCIDR }}
gateway={{ $netdev.Gateway }}
{{ end -}}
method=manual
{{- $dns := "" }}
{{range $tk, $tv := $netdev.Tags -}}
{{ $prefix := slice $tk 0 3 -}}
{{ if eq $prefix "DNS" -}}
{{ $dns = print $dns $tv ";" -}}
{{ end -}}
{{ end -}}
{{ if ne $dns "" -}}
dns={{$dns}}
{{ end -}}
{{ end -}}
{{/* always autoconfigure ipv6 */}}

View File

@@ -0,0 +1,15 @@
{{- $host := .BuildHost }}
{{- $time := .BuildTime }}
{{- $source := .BuildSource }}
# This file is autogenerated by warewulf
# Host: {{ $host }}
# Time: {{ $time }}
# Source: {{ $source }}
{{range $devname, $netdev := .NetDevs -}}
{{range $tk, $tv := $netdev.Tags -}}
{{ $prefix := slice $tk 0 3 -}}
{{ if eq $prefix "DNS" -}}
nameserver {{ $tv }}
{{ end -}}
{{ end -}}
{{ end -}}

View File

@@ -37,4 +37,10 @@ IPV6_FAILURE_FATAL=no
{{ if $netdev.Ipaddr6 -}}
IPV6ADDR="{{ $netdev.Ipaddr6 }}"
{{ end -}}
{{range $tk, $tv := $netdev.Tags -}}
{{ $prefix := slice $tk 0 3 -}}
{{ if eq $prefix "DNS" -}}
{{ $tk }}={{ $tv }}
{{ end -}}
{{ end -}}
{{ end -}}