Static IP assignment

I've done some Google searches trying to find out how to do this with
Foreman. So far all I have is to figure out the MAC for the VM, and plug
that into the dhcpd.conf file. I don't think that will work well for me, as
VMWare assigns MACs when the VM is created.

Here are the contents of my Kickstart default surrounding this:

network --bootproto <%= @static ? "static" : "dhcp" %> --hostname <%= @host
%>

and here s the PXE:

append initrd=<%= @initrd %> ks=<%= foreman_url("provision")%>
ksdevice=eth0 network kssendmac ip=<%= @host.ip %> netmask=<%=
@host.subnet.mask %> gateway=<%= @host.subnet.gateway %> dns=<%=
@host.subnet.dns_primary %>

So I kick off a build and the VM completes, but it does not use the static
address. Looking at the VM templates I see it is still pulling the dhcp
address used to start the pxe process.

Use puppet to make it static. Check out the puppet-network modules on Forge.

··· > On Dec 2, 2013, at 8:27 PM, Robert Vernon wrote: > > I've done some Google searches trying to find out how to do this with Foreman. So far all I have is to figure out the MAC for the VM, and plug that into the dhcpd.conf file. I don't think that will work well for me, as VMWare assigns MACs when the VM is created. > > Here are the contents of my Kickstart default surrounding this: > > network --bootproto <%= @static ? "static" : "dhcp" %> --hostname <%= @host %> > > and here s the PXE: > > append initrd=<%= @initrd %> ks=<%= foreman_url("provision")%> ksdevice=eth0 network kssendmac ip=<%= @host.ip %> netmask=<%= @host.subnet.mask %> gateway=<%= @host.subnet.gateway %> dns=<%= @host.subnet.dns_primary %> > > So I kick off a build and the VM completes, but it does not use the static address. Looking at the VM templates I see it is still pulling the dhcp address used to start the pxe process. > > > -- > 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+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/groups/opt_out.

> Here are the contents of my Kickstart default surrounding this:
>
> network --bootproto <%= @static ? "static" : "dhcp" %> --hostname <%=
> @host %>

Change this to the line in our updated templates:

https://github.com/theforeman/community-templates/blob/master/kickstart/provision.erb#L16

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 %>

Note that you'll need to ensure the subnet in Foreman
(More>Provisioning>Subnets) has the gateway, DNS server(s) etc all
configured as it'll use this data.

> and here s the PXE:
>
> append initrd=<%= @initrd %> ks=<%= foreman_url("provision")%>
> ksdevice=eth0 network kssendmac ip=<%= @host.ip %> netmask=<%=
> @host.subnet.mask %> gateway=<%= @host.subnet.gateway %> dns=<%=
> @host.subnet.dns_primary %>

And change the ks= bit in the middle here to request the template
containing the static IP details:

ks=<%= foreman_url("provision")%>?static=yes

··· On 03/12/13 01:27, Robert Vernon wrote:


Dominic Cleal
Red Hat Engineering

Pro tip: Install system-config-kickstart and use ksvalidator tool which
is able to find you syntax errors easily for all possible Fedora/RHEL
version out there.

LZ

··· On Mon, Dec 02, 2013 at 05:27:03PM -0800, Robert Vernon wrote: > I've done some Google searches trying to find out how to do this with > Foreman. So far all I have is to figure out the MAC for the VM, and plug > that into the dhcpd.conf file. I don't think that will work well for me, as > VMWare assigns MACs when the VM is created. > > Here are the contents of my Kickstart default surrounding this: > > network --bootproto <%= @static ? "static" : "dhcp" %> --hostname <%= @host > %> > > and here s the PXE: > > append initrd=<%= @initrd %> ks=<%= foreman_url("provision")%> > ksdevice=eth0 network kssendmac ip=<%= @host.ip %> netmask=<%= > @host.subnet.mask %> gateway=<%= @host.subnet.gateway %> dns=<%= > @host.subnet.dns_primary %> > > So I kick off a build and the VM completes, but it does not use the static > address. Looking at the VM templates I see it is still pulling the dhcp > address used to start the pxe process. > > > -- > 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+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/groups/opt_out.


Later,

Lukas “lzap” Zapletal
irc: lzap #theforeman

Yep.

Thanks. I was just about to look into this. it might take me a minute but I
think I can make this work.

I'll update this thread on what I did to make it work.

Can I set parameters on a per host basis?

R

··· On Tuesday, December 3, 2013 9:30:49 AM UTC+8, Josh wrote: > > Use puppet to make it static. Check out the puppet-network modules on > Forge. > > On Dec 2, 2013, at 8:27 PM, Robert Vernon <robert.n...@gmail.com> > wrote: > > I've done some Google searches trying to find out how to do this with > Foreman. So far all I have is to figure out the MAC for the VM, and plug > that into the dhcpd.conf file. I don't think that will work well for me, as > VMWare assigns MACs when the VM is created. > > Here are the contents of my Kickstart default surrounding this: > > network --bootproto <%= @static ? "static" : "dhcp" %> --hostname <%= > @host %> > > and here s the PXE: > > append initrd=<%= @initrd %> ks=<%= foreman_url("provision")%> > ksdevice=eth0 network kssendmac ip=<%= @host.ip %> netmask=<%= > @host.subnet.mask %> gateway=<%= @host.subnet.gateway %> dns=<%= > @host.subnet.dns_primary %> > > So I kick off a build and the VM completes, but it does not use the static > address. Looking at the VM templates I see it is still pulling the dhcp > address used to start the pxe process. > > > -- > 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-user...@googlegroups.com . > To post to this group, send email to forema...@googlegroups.com > . > Visit this group at http://groups.google.com/group/foreman-users. > For more options, visit https://groups.google.com/groups/opt_out. > >

> Yep.
>
> Thanks. I was just about to look into this. it might take me a minute but
> I think I can make this work.
>

At my site, we make the IP assignment static from Debian/Ubuntu Preseed.
Kickstart probably has similar mechanisms. This way it's sort of baked in
when the instance comes up.

> I'll update this thread on what I did to make it work.
>
> Can I set parameters on a per host basis?
>

DHCP parameters?

··· On Mon, Dec 2, 2013 at 7:36 PM, Robert Vernon wrote:

R

On Tuesday, December 3, 2013 9:30:49 AM UTC+8, Josh wrote:

Use puppet to make it static. Check out the puppet-network modules on
Forge.

On Dec 2, 2013, at 8:27 PM, Robert Vernon robert.n...@gmail.com wrote:

I’ve done some Google searches trying to find out how to do this with
Foreman. So far all I have is to figure out the MAC for the VM, and plug
that into the dhcpd.conf file. I don’t think that will work well for me, as
VMWare assigns MACs when the VM is created.

Here are the contents of my Kickstart default surrounding this:

network --bootproto <%= @static ? “static” : “dhcp” %> --hostname <%=
@host %>

and here s the PXE:

append initrd=<%= @initrd %> ks=<%= foreman_url(“provision”)%>
ksdevice=eth0 network kssendmac ip=<%= @host.ip %> netmask=<%=
@host.subnet.mask %> gateway=<%= @host.subnet.gateway %> dns=<%=
@host.subnet.dns_primary %>

So I kick off a build and the VM completes, but it does not use the
static address. Looking at the VM templates I see it is still pulling the
dhcp address used to start the pxe process.


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-user...@googlegroups.com.
To post to this group, send email to forema...@googlegroups.com.

Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/groups/opt_out.


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+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/groups/opt_out.

Got it. I used that tool to double check my configs.

everything is working now.

Thanks all.

··· On Wednesday, December 4, 2013 12:42:00 AM UTC+8, Lukas Zapletal wrote: > > Pro tip: Install system-config-kickstart and use ksvalidator tool which > is able to find you syntax errors easily for all possible Fedora/RHEL > version out there. > > LZ > > On Mon, Dec 02, 2013 at 05:27:03PM -0800, Robert Vernon wrote: > > I've done some Google searches trying to find out how to do this with > > Foreman. So far all I have is to figure out the MAC for the VM, and plug > > that into the dhcpd.conf file. I don't think that will work well for me, > as > > VMWare assigns MACs when the VM is created. > > > > Here are the contents of my Kickstart default surrounding this: > > > > network --bootproto <%= @static ? "static" : "dhcp" %> --hostname <%= > @host > > %> > > > > and here s the PXE: > > > > append initrd=<%= @initrd %> ks=<%= foreman_url("provision")%> > > ksdevice=eth0 network kssendmac ip=<%= @host.ip %> netmask=<%= > > @host.subnet.mask %> gateway=<%= @host.subnet.gateway %> dns=<%= > > @host.subnet.dns_primary %> > > > > So I kick off a build and the VM completes, but it does not use the > static > > address. Looking at the VM templates I see it is still pulling the dhcp > > address used to start the pxe process. > > > > > > -- > > 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-user...@googlegroups.com . > > To post to this group, send email to forema...@googlegroups.com. > > > Visit this group at http://groups.google.com/group/foreman-users. > > For more options, visit https://groups.google.com/groups/opt_out. > > -- > Later, > > Lukas "lzap" Zapletal > irc: lzap #theforeman >