theforeman / foreman_fog_proxmox

Foreman plugin to add Proxmox compute resource based on fog-proxmox gem
GNU General Public License v3.0
105 stars 30 forks source link

Problem running preseed_networking_setup #192

Closed ahoiroman closed 3 years ago

ahoiroman commented 3 years ago

I am setting up a new proxmox-based host using ipxe and Preseed-Templates.

On preseed_networking_setup, the following line seems to fail:

<% host_subnet = @host.subnet -%>
<% host_dhcp = host_subnet.nil? ? true : host_subnet.dhcp_boot_mode? -%>
<% host_subnet6 = @host.subnet6 -%>
<% host_dhcp6 = host_subnet6.nil? ? true : host_subnet6.dhcp_boot_mode? -%>

real=`ip -o link | awk '/<%= @host.mac -%>/ {print $2;}' | sed s/://`
cat << EOF > /etc/network/interfaces

The result (/etc/network/interfaces) is

#loopback
auto lo
iface lo inet loopback

#net0
auto
allow-hotplug 
iface  inet static
    address 123.123.123.123
    gateway 123.123.123.1
    netmask 255.255.255.224
    dns-nameservers 208.67.222.222 208.67.220.220
    dns-search my.zone

Seems like $real is empty during setup. But now if I run

ip -o link | awk '/86:ce:ea:52:51:42/ {print $2;}' | sed s/://

on this very host, I am getting ens18 as result. This is not the interface-name I set up during creation (net0) and I am wondering if this could be an issue with the Proxmox-plugin or a more generic error.

ahoiroman commented 3 years ago

I just saw that the device's name is ens18 even during the installation process.

Bildschirmfoto 2021-04-13 um 15 26 31

I'm curious why this is the case and whether or not it's possible to change this "default name", because it causes trouble not only during provisioning, but also after first boot if I fix the /etc/network/interfaces adding the interface's name ens18 because that will lead to an error once the host is updated in foreman (the interface-name would not match net[n] and therefore the host could not be saved).

ahoiroman commented 3 years ago

I fixed an error in the preseeding-template and changed

real=`ip -o link | awk '/<%= @host.mac -%>/ {print $2;}' | sed s/://`

to

real=`ip -o link | grep -i '<%= @host.mac -%>' | cut -d' ' -f2 | sed s/://`

This let's the installer create a correct interface-configuration but does not solve the problem that the interface is named ens18 which leads to an error when I modify the host. I will create a new issue for that.

tbasset commented 3 years ago

similar but different,

real=/sbin/ip -o link | awk '/<%= @host.mac.downcase -%>/ {print $2;}' | sed s/://

T

Le 14/04/2021 à 11:30, ahoiroman a écrit :

I fixed an error in the preseeding-template and changed

|real=ip -o link | awk '/<%= @host.mac -%>/ {print $2;}' | sed s/:// |

to

|real=ip -o link | grep -i '<%= @host.mac -%>' | cut -d' ' -f2 | sed s/:// |

This let's the installer create a correct interface-configuration but does not solve the problem that the interface is named |ens18| which leads to an error when I modify the host. I will create a new issue for that.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/theforeman/foreman_fog_proxmox/issues/192#issuecomment-819377284, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACWXOHGAHHJ5H3PZIEVU3S3TIVODNANCNFSM422ZCZQQ.