I would like to modify the 'Kickstart default PXELinux' template, so for
VMware hosts, to append the following two kernel parameters:
net.ifnames=0 biosdevname=0
I'm doing in an attempt to avoid the dreaded ‘consistent network device
naming’ problem with CentOS 7 & VMware, which creates strange network
device names like 'eno1234567', instead of the more familiar names like
'eth0' or 'eno1'.
From the 'Kickstart default PXELinux' template, can I determine if a
machine is virtual or not?
I added the following to Kickstart default PXELinux [1], but it doesn't
seem to work during the PXEboot. Probably because it relies on Puppet
facts, and nothing has been installed yet.
<%-# If VMware, than avoid ‘consistent network device naming’ by passing
kernel params. Else, use the default. -%>
<% if @host.facts['virtual'] == 'vmware' -%>
append initrd=<%= @initrd %> ks=<%= foreman_url('provision')%> network
ks.sendmac net.ifnames=0 biosdevname=0
<% else -%>
append initrd=<%= @initrd %> ks=<%= foreman_url('provision')%> network
ks.sendmac
<% end -%>
Is there another parameter the I can use instead?
-= Stefan
[1] https://github.com/theforeman/foreman/blob/7b966530c9ba48b2a37416465a3c9619f7143387/app/views/unattended/kickstart/PXELinux.erb
You could probably do:
<% if @host.compute_resource.nil? %>
to check if it's bare metal, or invert (unless @host …) for virtual.
···
On 03/06/16 01:16, Stefan Lasiewski wrote:
> I would like to modify the 'Kickstart default PXELinux' template, so for
> VMware hosts, to append the following two kernel parameters:
>
> >
> net.ifnames=0biosdevname=0
> >
>
>
>
> I'm doing in an attempt to avoid the dreaded ‘consistent network device
> naming’ problem with CentOS 7 & VMware, which creates strange network
> device names like 'eno1234567', instead of the more familiar names like
> 'eth0' or 'eno1'.
>
> From the 'Kickstart default PXELinux' template, can I determine if a
> machine is virtual or not?
–
Dominic Cleal
dominic@cleal.org
Bit late with this, but the syntax we use at the moment is:
<% if @host.operatingsystem.name == 'RedHat' and @osver == 7 and
(@host.mac.start_with?("00:50:56:") or @host.mac.start_with?("00:0c:29:"))
-%>
open-vm-tools.x86_64
-microcode_ctl
<% end -%>
during the package list section to add open-vm-tools to RHEL 7 builds when
necessary.
D
···
On Friday, 3 June 2016 01:16:45 UTC+1, Stefan Lasiewski wrote:
>
> I would like to modify the 'Kickstart default PXELinux' template, so for
> VMware hosts, to append the following two kernel parameters:
>
> net.ifnames=0 biosdevname=0
>
>
>
> I'm doing in an attempt to avoid the dreaded ‘consistent network device
> naming’ problem with CentOS 7 & VMware, which creates strange network
> device names like 'eno1234567', instead of the more familiar names like
> 'eth0' or 'eno1'.
>
> From the 'Kickstart default PXELinux' template, can I determine if a
> machine is virtual or not?
>
> I added the following to Kickstart default PXELinux [1], but it doesn't
> seem to work during the PXEboot. Probably because it relies on Puppet
> facts, and nothing has been installed yet.
>
> <%-# If VMware, than avoid ‘consistent network device naming’ by passing
> kernel params. Else, use the default. -%>
> <% if @host.facts['virtual'] == 'vmware' -%>
> append initrd=<%= @initrd %> ks=<%= foreman_url('provision')%> network
> ks.sendmac net.ifnames=0 biosdevname=0
> <% else -%>
> append initrd=<%= @initrd %> ks=<%= foreman_url('provision')%> network
> ks.sendmac
> <% end -%>
>
>
>
> Is there another parameter the I can use instead?
>
>
> -= Stefan
>
> [1]
> https://github.com/theforeman/foreman/blob/7b966530c9ba48b2a37416465a3c9619f7143387/app/views/unattended/kickstart/PXELinux.erb
>
Just as a warning, this wouldn't work if you're discovering hosts with
foreman_discovery as those won't have a Compute Resource even if they're
actually VMs.
···
On 06/03, Dominic Cleal wrote:
> On 03/06/16 01:16, Stefan Lasiewski wrote:
> > I would like to modify the 'Kickstart default PXELinux' template, so for
> > VMware hosts, to append the following two kernel parameters:
> >
> > >
> > net.ifnames=0biosdevname=0
> > >
> >
> >
> >
> > I'm doing in an attempt to avoid the dreaded ‘consistent network device
> > naming’ problem with CentOS 7 & VMware, which creates strange network
> > device names like 'eno1234567', instead of the more familiar names like
> > 'eth0' or 'eno1'.
> >
> > From the 'Kickstart default PXELinux' template, can I determine if a
> > machine is virtual or not?
>
> You could probably do:
>
> <% if @host.compute_resource.nil? %>
>
> to check if it's bare metal, or invert (unless @host ...) for virtual.
>
–
Daniel Lobato Garcia
@dLobatog
blog.daniellobato.me
daniellobato.me
GPG: http://keys.gnupg.net/pks/lookup?op=get&search=0x7A92D6DD38D6DE30
Keybase: https://keybase.io/elobato
Thanks guys.
The following syntax in 'Kickstart default PXELinux' seems to work:
<% if @host.operatingsystem.name == 'Fedora' and @host.operatingsystem.major
.to_i > 16 -%>
append initrd=<%= @initrd %> ks=<%= foreman_url('provision')%>
ks.device=bootif network ks.sendmac
<% elsif @host.operatingsystem.name != 'Fedora' and @host.operatingsystem.
major.to_i >= 7 -%>
<%-# If VMware (Actually, any VM), than avoid ‘consistent network device
naming’ by passing kernel params. Else, use the default. -%>
<% if @host.compute_resource.nil? -%>
append initrd=<%= @initrd %> ks=<%= foreman_url('provision')%> network
ks.sendmac net.ifnames=0 biosdevname=0
<% else -%>
append initrd=<%= @initrd %> ks=<%= foreman_url('provision')%> network
ks.sendmac
<% end -%>
<% else -%>
append initrd=<%= @initrd %> ks=<%= foreman_url('provision')%>
ksdevice=bootif network kssendmac
<% end -%>
On the downside, I think this would affect all virtual machines, including
things like KVM & oVirt, and I'd like to only fix this for VMware. But for
what I need to do now, this is sufficient.
I was also referred issue 229 in community templates which uses a different
method. See "Add a conditional to set net.ifnames=0 on the kernel command
line #229 " at https://github.com/theforeman/community-templates/pull/229 .
I also wonder if the <%= options %>
value could be used for this. I'm not
sure if I should also modify the bootloader lines in the 'Kickstart
default' template, but modifying 'Kickstart default PXELinux' seems to be
good enough. I believe that if the 'net.ifnames=0 biosdevname=0' options
are used when loading PXElinux during install, they may persist on the OS
during any reboots.
Thanks,
-= Stefan
···
On Friday, June 3, 2016 at 3:44:38 AM UTC-7, Daniel Lobato wrote:
>
> On 06/03, Dominic Cleal wrote:
> > On 03/06/16 01:16, Stefan Lasiewski wrote:
> > > I would like to modify the 'Kickstart default PXELinux' template, so
> for
> > > VMware hosts, to append the following two kernel parameters:
> > >
> > > >
> > > net.ifnames=0biosdevname=0
> > > >
> > >
> > >
> > >
> > > I'm doing in an attempt to avoid the dreaded ‘consistent network
> device
> > > naming’ problem with CentOS 7 & VMware, which creates strange network
> > > device names like 'eno1234567', instead of the more familiar names
> like
> > > 'eth0' or 'eno1'.
> > >
> > > From the 'Kickstart default PXELinux' template, can I determine if a
> > > machine is virtual or not?
> >
> > You could probably do:
> >
> > <% if @host.compute_resource.nil? %>
> >
> > to check if it's bare metal, or invert (unless @host ...) for virtual.
> >
>
> Just as a warning, this wouldn't work if you're discovering hosts with
> foreman_discovery as those won't have a Compute Resource even if they're
> actually VMs.
>
> --
> Daniel Lobato Garcia
>
> @dLobatog
> blog.daniellobato.me
> daniellobato.me
>
> GPG: http://keys.gnupg.net/pks/lookup?op=get&search=0x7A92D6DD38D6DE30
> Keybase: https://keybase.io/elobato
>
Actually, I got that wrong. The following should actually be negated,
because @host.compute_resource.nil?
returns true if the host DOESN'T have
a compute_resource so:
<% if @host.compute_resource.nil? -%>
The following syntax might be even more explicit and apply to VMware only.
This uses the @host.provider
parameter.
<% if @host.operatingsystem.name == 'Fedora' and
@host.operatingsystem.major.to_i > 16 -%>
append initrd=<%= @initrd %> ks=<%= foreman_url('provision')%>
ks.device=bootif network ks.sendmac
<% elsif @host.operatingsystem.name != 'Fedora' and
@host.operatingsystem.major.to_i >= 7 -%>
<%-# If host is VMware (If it uses the VMware provider), than pass kernel
params to avoid ‘consistent network device naming’. Else, use the default.
-%>
<% if @host.provider == 'VMware' -%>
append initrd=<%= @initrd %> ks=<%= foreman_url('provision')%> network
ks.sendmac net.ifnames=0 biosdevname=0
<% else -%>
append initrd=<%= @initrd %> ks=<%= foreman_url('provision')%> network
ks.sendmac
<% end -%>
<% else -%>
append initrd=<%= @initrd %> ks=<%= foreman_url('provision')%>
ksdevice=bootif network kssendmac
<% end -%>
Thanks,
-= Stefan
···
On Fri, Jun 3, 2016 at 11:36 AM, Stefan Lasiewski wrote:
Thanks guys.
The following syntax in ‘Kickstart default PXELinux’ seems to work:
<% if @host.operatingsystem.name == ‘Fedora’ and @host.operatingsystem.
major.to_i > 16 -%>
append initrd=<%= @initrd %> ks=<%= foreman_url(‘provision’)%>
ks.device=bootif network ks.sendmac
<% elsif @host.operatingsystem.name != ‘Fedora’ and @host.operatingsystem.
major.to_i >= 7 -%>
<%-# If VMware (Actually, any VM), than avoid ‘consistent network device
naming’ by passing kernel params. Else, use the default. -%>
<% if @host.compute_resource.nil? -%>
append initrd=<%= @initrd %> ks=<%= foreman_url(‘provision’)%> network
ks.sendmac net.ifnames=0 biosdevname=0
<% else -%>
append initrd=<%= @initrd %> ks=<%= foreman_url(‘provision’)%> network
ks.sendmac
<% end -%>
<% else -%>
append initrd=<%= @initrd %> ks=<%= foreman_url(‘provision’)%>
ksdevice=bootif network kssendmac
<% end -%>
On the downside, I think this would affect all virtual machines, including
things like KVM & oVirt, and I’d like to only fix this for VMware. But for
what I need to do now, this is sufficient.
I was also referred issue 229 in community templates which uses a
different method. See "Add a conditional to set net.ifnames=0 on the kernel
command line #229 " at
https://github.com/theforeman/community-templates/pull/229 .
I also wonder if the <%= options %>
value could be used for this. I’m
not sure if I should also modify the bootloader lines in the ‘Kickstart
default’ template, but modifying ‘Kickstart default PXELinux’ seems to
be good enough. I believe that if the ‘net.ifnames=0 biosdevname=0’ options
are used when loading PXElinux during install, they may persist on the OS
during any reboots.
Thanks,
-= Stefan
On Friday, June 3, 2016 at 3:44:38 AM UTC-7, Daniel Lobato wrote:
On 06/03, Dominic Cleal wrote:
On 03/06/16 01:16, Stefan Lasiewski wrote:
I would like to modify the ‘Kickstart default PXELinux’ template, so
for
VMware hosts, to append the following two kernel parameters:
>
net.ifnames=0biosdevname=0
>
I’m doing in an attempt to avoid the dreaded ‘consistent network
device
naming’ problem with CentOS 7 & VMware, which creates strange network
device names like ‘eno1234567’, instead of the more familiar names
like
‘eth0’ or ‘eno1’.
From the ‘Kickstart default PXELinux’ template, can I determine if a
machine is virtual or not?
You could probably do:
<% if @host.compute_resource.nil? %>
to check if it’s bare metal, or invert (unless @host …) for virtual.
Just as a warning, this wouldn’t work if you’re discovering hosts with
foreman_discovery as those won’t have a Compute Resource even if they’re
actually VMs.
–
Daniel Lobato Garcia
@dLobatog
blog.daniellobato.me
daniellobato.me
GPG: http://keys.gnupg.net/pks/lookup?op=get&search=0x7A92D6DD38D6DE30
Keybase: https://keybase.io/elobato
–
You received this message because you are subscribed to a topic in the
Google Groups “Foreman users” group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/foreman-users/0xxCBoV4uSI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.
–
Stefan Lasiewski Email: stefanl@nersc.gov
Computer System Engineer III Email: slasiewski@lbl.gov
NERSC Data Infrastructure Group
National Energy Research Scientific Computing Center (NERSC
http://nersc.gov)
Lawrence Berkeley National Laboratory