Re: [foreman-users] provisioning a system with two NIC

2017-05-25 Thread Edward Clay
I would like to apologize for my mistake here.  Looks like I had setup
the public network/subnet as dhcp instead of static.  Once I did all
was better.  I can now provision a server and the public interface is
configured using the static IP while the internal one is configured
using dhcp.

Thanks for the help.

On Wed, 2017-05-24 at 08:39 +0200, Lukas Zapletal wrote:
> So the output artifact is rhcfg network configuration file, that's
> clear. You probably struggle with our ERB templating engine, it's
> actually ERB (google that) bug in SafeMode which means only selected
> variables and functions are available. In Foreman 1.14+ there is a
> Help tab in the Template editor which shows you the list.
> 
> LZ
> 
> On Tue, May 23, 2017 at 8:52 PM, Edward Clay  m> wrote:
> > Lukas, Thanks for this information.  I gues what I need to do is
> > figure
> > out how to create my own snippet since most of this info isn't
> > clear to
> > me.  Where would be the best place to start learning how to do
> > this?
> > 
> > On Tue, 2017-05-23 at 09:05 +0200, Lukas Zapletal wrote:
> > > Hello,
> > > 
> > > in this case you want to leave default kickstart template
> > > "network"
> > > configuration as is and only change post configuration for
> > > network:
> > > 
> > > https://github.com/theforeman/community-templates/blob/develop/pr
> > > ovis
> > > ioning_templates/snippet/kickstart_networking_setup.erb
> > > 
> > > This is a snippet that is inserted into default kickstart:
> > > 
> > > <%= snippet 'kickstart_networking_setup' %>
> > > 
> > > You perhaps want to create new snippet and configure your cards
> > > to
> > > your needs. That's the easiest method.
> > > 
> > > You an also provide some flag (host parameter) that will override
> > > the
> > > default behavior and configure NIC as static, then you can add
> > > this
> > > parameter to hostgroup or something. You can do pretty much
> > > anything
> > > you want.
> > > 
> > > But if you want to start with PXE and then "switch" to static at
> > > some
> > > point, Foreman itself does not support that. You can use Bootdisk
> > > instead of PXE which will work with static IP allocations tho.
> > > 
> > > LZ
> > > 
> > > On Tue, May 23, 2017 at 12:29 AM, Edward Clay  > > up.c
> > > om> wrote:
> > > > Hello,  I am trying to figure out how to best configure my
> > > > katello/foreman
> > > > provisioning kickstart template to configure a system with 2
> > > > NIC's.  One nic
> > > > is configured for private communication via a non routable ip
> > > > range.  We can
> > > > assign these IPs via dhcpd which we then use for doing the
> > > > provisioning
> > > > process via a local OS repo hosted on the katello/foreman
> > > > server.  The
> > > > second NIC is publicly accessible and is assigned
> > > > statically.  What
> > > > I'm not
> > > > sure how to do is pxe booting via the private interface
> > > > (currently
> > > > done by
> > > > assigning via dhcpd) and configuring both NIC via static
> > > > assignment
> > > > after
> > > > the provisioning process is complete.  It seems like I had this
> > > > working but
> > > > it's been a long time since I tinkered with this so my memory
> > > > could
> > > > be
> > > > wrong.  I believe this line was working in the past.
> > > > 
> > > > network --bootproto <%= dhcp ? 'dhcp --nodefroute' : "static
> > > > --ip=#{@host.ip} --netmask=#{subnet.mask} --
> > > > gateway=#{subnet.gateway}
> > > > --nameserver=#{[subnet.dns_primary,
> > > > subnet.dns_secondary].select(&:present?).join(',')}" %> --
> > > > hostname
> > > > <%= @host
> > > > %><%= os_major >= 6 ? " --device=#{@host.mac}" : '' -%>
> > > > 
> > > > I've configured the private NIC as Managed and Provision while
> > > > the
> > > > Public
> > > > NIC is configured as Primary.
> > > > 
> > > > Are there any working solutions out there for this scenario?
> > > > 
> > > > --
> > > > You received this message because you are subscribed to the
> > > > Google
> > > > Groups
> > > > "Foreman users" group.
> > > > To unsubscribe from this group and stop receiving emails from
> > > > it,
> > > > send an
> > > > email to foreman-users+unsubscr...@googlegroups.com.
> > > > To post to this group, send email to foreman-users@googlegroups
> > > > .com
> > > > .
> > > > Visit this group at https://groups.google.com/group/foreman-use
> > > > rs.
> > > > For more options, visit https://groups.google.com/d/optout.
> > > 
> > > 
> > > 
> > > --
> > > Later,
> > >   Lukas @lzap Zapletal
> > > 
> > 
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Foreman users" group.
> > To unsubscribe from this group and stop receiving emails from it,
> > send an email to foreman-users+unsubscr...@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 

Re: [foreman-users] provisioning a system with two NIC

2017-05-25 Thread Edward Clay
Thanks for directing me towards help.  Looking at the
kickstart_networking_sertup it seems to mention that it's going to
setup the primary interface.  When I look at the template details using
the spoof thing with the Host IP it only seems to show details about
the non primary interface.


This is what I see in the kickstart when I view it.

# enp6s0 interface
real=`ip -o link | grep 00:25:90:09:57:e4 | awk '{print $2;}' | sed
s/:$//`

# ifcfg files are ignored by NM if their name contains colons so we
convert colons to underscore
sanitized_real=$real

cat << EOF > /etc/sysconfig/network-scripts/ifcfg-$sanitized_real
BOOTPROTO="dhcp"
DEVICE=$real
HWADDR="00:25:90:09:57:e4"
ONBOOT=yes
PEERDNS=no
PEERROUTES=no
DEFROUTE=no
EOF

This isn't the primary interface.  The interface configured as primary
in foreman is one where the MAC address ends in 57:e5.  The
kickstart_default template is calling the kickstart_networking_setup
which says the following.

<%#
kind: snippet
name: kickstart_networking_setup
description: this will configure your host networking, it configures
your primary interface as well
as other configures NICs. It supports physical, VLAN and Alias
interfaces. It's intended to be
called from %post in your kickstart template. Note that this
snippet can be used with Foreman 1.7
and later
%>
This makes me think that this script should be doing what I am
expecting, configure the network interfaces based on the host
configuration in foreman.


   
On Wed, 2017-05-24 at 08:39 +0200, Lukas Zapletal wrote:
> So the output artifact is rhcfg network configuration file, that's
> clear. You probably struggle with our ERB templating engine, it's
> actually ERB (google that) bug in SafeMode which means only selected
> variables and functions are available. In Foreman 1.14+ there is a
> Help tab in the Template editor which shows you the list.
> 
> LZ
> 
> On Tue, May 23, 2017 at 8:52 PM, Edward Clay  m> wrote:
> > Lukas, Thanks for this information.  I gues what I need to do is
> > figure
> > out how to create my own snippet since most of this info isn't
> > clear to
> > me.  Where would be the best place to start learning how to do
> > this?
> > 
> > On Tue, 2017-05-23 at 09:05 +0200, Lukas Zapletal wrote:
> > > Hello,
> > > 
> > > in this case you want to leave default kickstart template
> > > "network"
> > > configuration as is and only change post configuration for
> > > network:
> > > 
> > > https://github.com/theforeman/community-templates/blob/develop/pr
> > > ovis
> > > ioning_templates/snippet/kickstart_networking_setup.erb
> > > 
> > > This is a snippet that is inserted into default kickstart:
> > > 
> > > <%= snippet 'kickstart_networking_setup' %>
> > > 
> > > You perhaps want to create new snippet and configure your cards
> > > to
> > > your needs. That's the easiest method.
> > > 
> > > You an also provide some flag (host parameter) that will override
> > > the
> > > default behavior and configure NIC as static, then you can add
> > > this
> > > parameter to hostgroup or something. You can do pretty much
> > > anything
> > > you want.
> > > 
> > > But if you want to start with PXE and then "switch" to static at
> > > some
> > > point, Foreman itself does not support that. You can use Bootdisk
> > > instead of PXE which will work with static IP allocations tho.
> > > 
> > > LZ
> > > 
> > > On Tue, May 23, 2017 at 12:29 AM, Edward Clay  > > up.c
> > > om> wrote:
> > > > Hello,  I am trying to figure out how to best configure my
> > > > katello/foreman
> > > > provisioning kickstart template to configure a system with 2
> > > > NIC's.  One nic
> > > > is configured for private communication via a non routable ip
> > > > range.  We can
> > > > assign these IPs via dhcpd which we then use for doing the
> > > > provisioning
> > > > process via a local OS repo hosted on the katello/foreman
> > > > server.  The
> > > > second NIC is publicly accessible and is assigned
> > > > statically.  What
> > > > I'm not
> > > > sure how to do is pxe booting via the private interface
> > > > (currently
> > > > done by
> > > > assigning via dhcpd) and configuring both NIC via static
> > > > assignment
> > > > after
> > > > the provisioning process is complete.  It seems like I had this
> > > > working but
> > > > it's been a long time since I tinkered with this so my memory
> > > > could
> > > > be
> > > > wrong.  I believe this line was working in the past.
> > > > 
> > > > network --bootproto <%= dhcp ? 'dhcp --nodefroute' : "static
> > > > --ip=#{@host.ip} --netmask=#{subnet.mask} --
> > > > gateway=#{subnet.gateway}
> > > > --nameserver=#{[subnet.dns_primary,
> > > > subnet.dns_secondary].select(&:present?).join(',')}" %> --
> > > > hostname
> > > > <%= @host
> > > > %><%= os_major >= 6 ? " --device=#{@host.mac}" : '' -%>
> > > > 
> > > > I've configured the private NIC as Managed and Provision while
> > > > the
> > > > Public
> > > > NIC is configured as 

Re: [foreman-users] provisioning a system with two NIC

2017-05-24 Thread Lukas Zapletal
So the output artifact is rhcfg network configuration file, that's
clear. You probably struggle with our ERB templating engine, it's
actually ERB (google that) bug in SafeMode which means only selected
variables and functions are available. In Foreman 1.14+ there is a
Help tab in the Template editor which shows you the list.

LZ

On Tue, May 23, 2017 at 8:52 PM, Edward Clay  wrote:
> Lukas, Thanks for this information.  I gues what I need to do is figure
> out how to create my own snippet since most of this info isn't clear to
> me.  Where would be the best place to start learning how to do this?
>
> On Tue, 2017-05-23 at 09:05 +0200, Lukas Zapletal wrote:
>> Hello,
>>
>> in this case you want to leave default kickstart template "network"
>> configuration as is and only change post configuration for network:
>>
>> https://github.com/theforeman/community-templates/blob/develop/provis
>> ioning_templates/snippet/kickstart_networking_setup.erb
>>
>> This is a snippet that is inserted into default kickstart:
>>
>> <%= snippet 'kickstart_networking_setup' %>
>>
>> You perhaps want to create new snippet and configure your cards to
>> your needs. That's the easiest method.
>>
>> You an also provide some flag (host parameter) that will override the
>> default behavior and configure NIC as static, then you can add this
>> parameter to hostgroup or something. You can do pretty much anything
>> you want.
>>
>> But if you want to start with PXE and then "switch" to static at some
>> point, Foreman itself does not support that. You can use Bootdisk
>> instead of PXE which will work with static IP allocations tho.
>>
>> LZ
>>
>> On Tue, May 23, 2017 at 12:29 AM, Edward Clay > om> wrote:
>> > Hello,  I am trying to figure out how to best configure my
>> > katello/foreman
>> > provisioning kickstart template to configure a system with 2
>> > NIC's.  One nic
>> > is configured for private communication via a non routable ip
>> > range.  We can
>> > assign these IPs via dhcpd which we then use for doing the
>> > provisioning
>> > process via a local OS repo hosted on the katello/foreman
>> > server.  The
>> > second NIC is publicly accessible and is assigned statically.  What
>> > I'm not
>> > sure how to do is pxe booting via the private interface (currently
>> > done by
>> > assigning via dhcpd) and configuring both NIC via static assignment
>> > after
>> > the provisioning process is complete.  It seems like I had this
>> > working but
>> > it's been a long time since I tinkered with this so my memory could
>> > be
>> > wrong.  I believe this line was working in the past.
>> >
>> > network --bootproto <%= dhcp ? 'dhcp --nodefroute' : "static
>> > --ip=#{@host.ip} --netmask=#{subnet.mask} --
>> > gateway=#{subnet.gateway}
>> > --nameserver=#{[subnet.dns_primary,
>> > subnet.dns_secondary].select(&:present?).join(',')}" %> --hostname
>> > <%= @host
>> > %><%= os_major >= 6 ? " --device=#{@host.mac}" : '' -%>
>> >
>> > I've configured the private NIC as Managed and Provision while the
>> > Public
>> > NIC is configured as Primary.
>> >
>> > Are there any working solutions out there for this scenario?
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "Foreman users" group.
>> > To unsubscribe from this group and stop receiving emails from it,
>> > send an
>> > email to foreman-users+unsubscr...@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.
>>
>>
>>
>> --
>> Later,
>>   Lukas @lzap Zapletal
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Foreman users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to foreman-users+unsubscr...@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.



-- 
Later,
  Lukas @lzap Zapletal

-- 
You received this message because you are subscribed to the Google Groups 
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to foreman-users+unsubscr...@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.


Re: [foreman-users] provisioning a system with two NIC

2017-05-23 Thread Lukas Zapletal
Hello,

in this case you want to leave default kickstart template "network"
configuration as is and only change post configuration for network:

https://github.com/theforeman/community-templates/blob/develop/provisioning_templates/snippet/kickstart_networking_setup.erb

This is a snippet that is inserted into default kickstart:

<%= snippet 'kickstart_networking_setup' %>

You perhaps want to create new snippet and configure your cards to
your needs. That's the easiest method.

You an also provide some flag (host parameter) that will override the
default behavior and configure NIC as static, then you can add this
parameter to hostgroup or something. You can do pretty much anything
you want.

But if you want to start with PXE and then "switch" to static at some
point, Foreman itself does not support that. You can use Bootdisk
instead of PXE which will work with static IP allocations tho.

LZ

On Tue, May 23, 2017 at 12:29 AM, Edward Clay  wrote:
> Hello,  I am trying to figure out how to best configure my katello/foreman
> provisioning kickstart template to configure a system with 2 NIC's.  One nic
> is configured for private communication via a non routable ip range.  We can
> assign these IPs via dhcpd which we then use for doing the provisioning
> process via a local OS repo hosted on the katello/foreman server.  The
> second NIC is publicly accessible and is assigned statically.  What I'm not
> sure how to do is pxe booting via the private interface (currently done by
> assigning via dhcpd) and configuring both NIC via static assignment after
> the provisioning process is complete.  It seems like I had this working but
> it's been a long time since I tinkered with this so my memory could be
> wrong.  I believe this line was working in the past.
>
> network --bootproto <%= dhcp ? 'dhcp --nodefroute' : "static
> --ip=#{@host.ip} --netmask=#{subnet.mask} --gateway=#{subnet.gateway}
> --nameserver=#{[subnet.dns_primary,
> subnet.dns_secondary].select(&:present?).join(',')}" %> --hostname <%= @host
> %><%= os_major >= 6 ? " --device=#{@host.mac}" : '' -%>
>
> I've configured the private NIC as Managed and Provision while the Public
> NIC is configured as Primary.
>
> Are there any working solutions out there for this scenario?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Foreman users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to foreman-users+unsubscr...@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.



-- 
Later,
  Lukas @lzap Zapletal

-- 
You received this message because you are subscribed to the Google Groups 
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to foreman-users+unsubscr...@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.