Can I create static interfaces without modifying the templates?

Hi all,

I am provisioning a system for Scientific Linux 6 (Similar to CentOS 6) and
I noticed that Foreman is making the primary interface use DHCP, when the
interface should be static, and should use the IP address that I typed into
the "IP address" field.

The "provision Template" is named "Kickstart default". When this template
renders, the network interface is defined like this:

network --bootproto dhcp --hostname myhost.example.org

The ERB code says this:

network --bootproto <%= @static ? "static --ip=#{@host.ip} 

–netmask=#{@host.subnet.mask} --gateway=#{@host.subnet.gateway}
–nameserver=#{[@host.subnet.dns_primary,@host.subnet.dns_secondary].reject{|n|
n.blank?}.join(',')}" : 'dhcp' %> --hostname <%= @host %>

If I manually add a Subnet and an address under
https://foreman.example.org/hosts/myhost.example.org/edit#network , should
Foreman know that this is a static address and not a DHCP address? Or is
"DHCP" assumed unless I force the interface to be dynamic?

I understand that I can work around this behavior using the suggestions at
KickstartStatic - Foreman .
However, for simplicity I would prefer to not change the template. Is there
another way to tell Forman to make this interface static and not dynamic?

Thank you,

-= Stefan

Hello Stefan,

this area received a lot changes recently, so knowing your exact Foreman
version would help. Based on snippets you sent I assume, you're running
Foreman 1.7. As you can see, there's a built-in @static variable that forces
static network configuration. This variable is based on static parameter
passed to Foreman when downloading a provision template (?static=true), so the
KickstartStatic - Foreman you found
should work for you.

In upcoming Foreman 1.8 this will be more user friendly and you won't need any
template updates. You'll just set a boot mode on your provision network to
static (fill in gateway, dns server etc) and it should work out of the box.

Hope this helps

··· -- Marek

On Wednesday 04 of March 2015 11:10:50 Stefan Lasiewski wrote:

Hi all,

I am provisioning a system for Scientific Linux 6 (Similar to CentOS 6) and
I noticed that Foreman is making the primary interface use DHCP, when the
interface should be static, and should use the IP address that I typed into
the “IP address” field.

The “provision Template” is named “Kickstart default”. When this template
renders, the network interface is defined like this:

network --bootproto dhcp --hostname myhost.example.org

The ERB code says this:

network --bootproto <%= @static ? "static --ip=#{@host.ip}

–netmask=#{@host.subnet.mask} --gateway=#{@host.subnet.gateway}
–nameserver=#{[@host.subnet.dns_primary,@host.subnet.dns_secondary].reject{

n> n.blank?}.join(’,’)}" : ‘dhcp’ %> --hostname <%= @host %>

If I manually add a Subnet and an address under
https://foreman.example.org/hosts/myhost.example.org/edit#network , should
Foreman know that this is a static address and not a DHCP address? Or is
"DHCP" assumed unless I force the interface to be dynamic?

I understand that I can work around this behavior using the suggestions at
KickstartStatic - Foreman .
However, for simplicity I would prefer to not change the template. Is there
another way to tell Forman to make this interface static and not dynamic?

Thank you,

-= Stefan


Marek

Yes this is 1.7. I'm trying to follow the conversation on 1.8, and I look
forward to the improvements. Thanks to everyone for working on it.

Thanks.

-= Stefan

··· On Wed, Mar 4, 2015 at 11:17 PM, Marek Hulan wrote:

Hello Stefan,

this area received a lot changes recently, so knowing your exact Foreman
version would help. Based on snippets you sent I assume, you’re running
Foreman 1.7. As you can see, there’s a built-in @static variable that
forces
static network configuration. This variable is based on static parameter
passed to Foreman when downloading a provision template (?static=true), so
the
KickstartStatic - Foreman you
found
should work for you.

In upcoming Foreman 1.8 this will be more user friendly and you won’t need
any
template updates. You’ll just set a boot mode on your provision network to
static (fill in gateway, dns server etc) and it should work out of the box.

Hope this helps


Marek

On Wednesday 04 of March 2015 11:10:50 Stefan Lasiewski wrote:

Hi all,

I am provisioning a system for Scientific Linux 6 (Similar to CentOS 6)
and
I noticed that Foreman is making the primary interface use DHCP, when the
interface should be static, and should use the IP address that I typed
into
the “IP address” field.

The “provision Template” is named “Kickstart default”. When this template
renders, the network interface is defined like this:

network --bootproto dhcp --hostname myhost.example.org

The ERB code says this:

network --bootproto <%= @static ? "static --ip=#{@host.ip}

–netmask=#{@host.subnet.mask} --gateway=#{@host.subnet.gateway}

–nameserver=#{[@host.subnet.dns_primary,@host.subnet.dns_secondary].reject{

n> n.blank?}.join(’,’)}" : ‘dhcp’ %> --hostname <%= @host %>

If I manually add a Subnet and an address under
https://foreman.example.org/hosts/myhost.example.org/edit#network ,
should
Foreman know that this is a static address and not a DHCP address? Or is
"DHCP" assumed unless I force the interface to be dynamic?

I understand that I can work around this behavior using the suggestions
at
KickstartStatic - Foreman .
However, for simplicity I would prefer to not change the template. Is
there
another way to tell Forman to make this interface static and not dynamic?

Thank you,

-= Stefan


Marek


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/5a2iu0d783U/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 http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.