Project

General

Profile

Download (1.36 KB) Statistics
| Branch: | Tag: | Revision:
<%#
name: preseed_netplan_generic_interface
model: ProvisioningTemplate
snippet: true
model: ProvisioningTemplate
kind: snippet
oses:
- Ubuntu
-%>
<%- if @interface.identifier.blank? -%>
id0:
match:
macaddress: "<%= @host.mac %>"
<%- else -%>
<%= @interface.identifier %>:
<%- end -%>
dhcp4: <%= @dhcp %>
dhcp6: <%= @dhcp6 %>
<%-
static_v4 = !@dhcp && !@subnet.nil? && !@interface.ip.nil?
static_v6 = !@dhcp6 && !@subnet6.nil? && !@interface.ip6.nil?
-%>
<%- if static_v4 || static_v6 -%>
addresses:
<%- if static_v4 -%>
- <%= @interface.ip %>/<%= @subnet.cidr %>
<%- end -%>
<%- if static_v6 -%>
- "<%= @interface.ip6 %>/<%= @subnet6.cidr %>"
<%- end -%>
<%- if static_v4 && @subnet.gateway.present? -%>
gateway4: <%= @subnet.gateway %>
<%- end -%>
<%- if static_v6 && @subnet6.gateway.present? -%>
gateway6: "<%= @subnet6.gateway %>"
<%- end -%>
<%- if @interface.primary -%>
nameservers:
search: [ <%= @interface.domain %> ]
addresses:
<%- if static_v4 -%>
<%- @subnet.dns_servers.each do |dns_server| -%>
- <%= dns_server %>
<%- end -%>
<%- end -%>
<%- if static_v6 -%>
<%- @subnet6.dns_servers.each do |dns6_server| -%>
- "<%= dns6_server %>"
<%- end -%>
<%- end -%>
<%- end -%>
<%- end -%>
(34-34/55)