Set up a Vlan interface that attached to the primary interface


Foreman version 1.20.2
CentOS 7.6

I want in the kickstart template set up two interface
One primary with static IP and no vlanID
Second one with static IP with VlanID and is attached to the primary interface

Have got it work by hard coding the second interface:
network --bootproto <%= dhcp ? ‘dhcp’ : “static --ip=#{@host.ip} --netmask=#{subnet.mask} --gateway=#{subnet.gateway} --nameserver=#{[subnet.dns_primary, subnet.dns_secondary].select{ |item| item.present? }.join(’,’)} --mtu=#{subnet.mtu.to_s}” %> --hostname <%= @host %><%= os_major >= 6 ? " --device=#{@host.mac}" : ‘’ -%> --noipv6
network --bootproto <%= dhcp ? ‘dhcp’ : “static --ip= --netmask= --gateway= --mtu=#{subnet.mtu.to_s} --vlanid=21” %> --device=em1 --nodefroute

This will only work for one machine.
So what variables and snippet can I use to do it properly?
Have not found any good documentation or examples on this

Our default templates only configure provisioning interface in Anaconda for the installation time. Then all the configuration is done again in the post section via this snippet:

This is included in the main kickstart at the very end. If you preview the template you will see it how it renders for your host. But if you insist on doing this in the network statement of Anaconda kickstart, take this as an example.