0

I write a custom Kickstart as a Foreman provisioning template. One of my problems is that I haven't found a way to determine if the new host will be installed on a bare metal or on a Hypervisor. The @host.model works on ESXi hypervisors, but Libvirt reports "Standard PC (i440FX + PIIX, 1996)"

As a work around, I use this string as libvirt identifier, but, it's not safe and it's a workaround.

So, which parameter should I use to determine if the server will be a virtual one or not?

Peter
  • 822
  • 2
  • 10
  • 23

2 Answers2

1

This will check if the host is linked to a compute resource:

<% if @host.compute_resource -%>
virtual, on a compute resource
<% else -%>
physical, bare metal
<% end -%>
Dominic Cleal
  • 3,160
  • 19
  • 16
0

You can use the virt-what(1) command to determine if you are on bare-metal or a virtualised environment.

user9517
  • 115,471
  • 20
  • 215
  • 297
  • Interesting. Is it available during kickstart? I will have to test it. I like that is a script-based solution so it's not binded with Ruby. – Peter Oct 31 '16 at 14:26