Foreman 1.11.2, ip static after boot dhcp

Hello,

I don't understand how to configure ip static after boot on dhcp.

My server boot on dhcp, it's ok but after in "interface configuration" it's
always in dhcp mode.
I would like provisionning with foreman proxy dhcp and after configuring ip
static.

If i change subnets with the option bootmode = static my server didn't find
a dhcp.
I tested to modify kickstart default PXELinux with ks=<%=
foreman_url('provision')%>&static=yes and "Kickstart default" network
–bootproto <%= @static ? "static but doesn't work

Can you help me please ?

My provision :
install
url --url http://mirror.centos.org/centos/7.2.1511/os/x86_64
lang en_US.UTF-8
selinux --enforcing
keyboard us
skipx

network --bootproto dhcp --hostname tnbilminf06.mydomain.local
–device=00:50:56:aa:87:5b

rootpw --iscrypted $5$VC26vOJg$4bRwvz4Q1eA94p/7zClwFhtqG2a71YkUDUW7aaJhMKC
firewall --service=ssh
authconfig --useshadow --passalgo=sha256 --kickstart
timezone --utc UTC
services --disabled
gpm,sendmail,cups,pcmcia,isdn,rawdevices,hpoj,bluetooth,openibd,avahi-daemon,avahi-dnsconfd,hidd,hplip,pcscd

repo --name="EPEL"
–mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=x86_64

*bootloader --location=mbr --append="nofb quiet splash=quiet" *

zerombr

clearpart --none --initlabel
part /boot --fstype="xfs" --ondisk=sda --size=1024
part pv.155 --fstype="lvmpv" --ondisk=sda --size=19455
volgroup vgos --pesize=4096 pv.155
logvol swap --fstype="swap" --size=4092 --name=swap --vgname=vgos
logvol /home --fstype="xfs" --size=1024 --name=home --vgname=vgos
logvol /tmp --fstype="xfs" --size=4096 --name=tmp --vgname=vgos
logvol /var --fstype="xfs" --size=2048 --name=var --vgname=vgos
logvol / --fstype="xfs" --size=8192 --name=root --vgname=vgos

text
reboot

%packages
yum
dhclient
ntp
wget
@Core
redhat-lsb-core
epel-release

puppet
%end

%post --nochroot
exec < /dev/tty3 > /dev/tty3
#changing to VT 3 so that we can see whats going on…
/usr/bin/chvt 3
(
cp -va /etc/resolv.conf /mnt/sysimage/etc/resolv.conf
/usr/bin/chvt 1
) 2>&1 | tee /mnt/sysimage/root/install.postnochroot.log
%end
%post
logger "Starting anaconda tnbilminf06.mydomain.local postinstall"
exec < /dev/tty3 > /dev/tty3
#changing to VT 3 so that we can see whats going on…
/usr/bin/chvt 3
(

# interface
real=ip -o link | grep 00:50:56:aa:87:5b | awk &#39;{print $2;}&#39; | 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:50:56:aa:87:5b"
ONBOOT=yes
PEERDNS=yes
PEERROUTES=yes
EOF

#update local time
echo "updating system time"
/usr/sbin/ntpdate -sub 0.fedora.pool.ntp.org
/usr/sbin/hwclock --systohc

# update all the base packages from the updates repository
yum -t -y -e 0 update

echo "Configuring puppet"
cat > /etc/puppet/puppet.conf << EOF

[main]
vardir = /var/lib/puppet
logdir = /var/log/puppet
rundir = /var/run/puppet
ssldir = $vardir/ssl

[agent]
pluginsync = true
report = true
ignoreschedules = true
daemon = false
ca_server = tnbilminf03.mydomain.local
certname = tnbilminf06.mydomain.local
environment = production
server = tnbilminf03.mydomain.local
EOF
# Setup puppet to run on system reboot
/sbin/chkconfig --level 345 puppet on
/usr/bin/puppet agent --config /etc/puppet/puppet.conf -o --tags
no_such_tag --server tnbilminf03.mydomain.local --no-daemonize

sync
# Inform the build system that we are done.
echo "Informing Foreman that we are built"
wget -q -O /dev/null --no-check-certificate
http://tnbilminf03.mydomain.local/unattended/built?token=84b60e42-b1e0-4504-b9c6-485dc4bd3bd8

) 2>&1 | tee /root/install.post.log
exit 0
%end

Ok i have change kickstart_networking_setup
<https://172.23.2.26/templates/provisioning_templates/48-kickstart_networking_setup/edit>
to

<%#
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
%>
<% subnet = @host.subnet -%>
<% dhcp = subnet.dhcp_boot_mode? -%>

primary interface

real=ip -o link | grep &lt;%= @host.mac -%&gt; | awk &#39;{print $2;}&#39; | sed s/://
cat << EOF > /etc/sysconfig/network-scripts/ifcfg-$real
BOOTPROTO="none"
IPADDR="<%= @host.ip -%>"
NETMASK="<%= subnet.mask -%>"
GATEWAY="<%= subnet.gateway %>"
DEVICE=$real
HWADDR="<%= @host.mac -%>"
ONBOOT=yes
EOF

I'm not sure it's a good solution but it works !!!

I believe you can control this through the subnet definition.
In the subnet there is a parameter called "Boot mode" which can be either
static or dhcp.

HTH, Elisiano

··· On Tuesday, May 24, 2016 at 2:24:03 PM UTC-4, Benoit Pluchet wrote: > > Ok i have change kickstart_networking_setup > > to > > <%# > 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 > %> > <% subnet = @host.subnet -%> > <% dhcp = subnet.dhcp_boot_mode? -%> > # primary interface > real=`ip -o link | grep <%= @host.mac -%> | awk '{print $2;}' | sed s/://` > cat < /etc/sysconfig/network-scripts/ifcfg-$real > BOOTPROTO="none" > IPADDR="<%= @host.ip -%>" > NETMASK="<%= subnet.mask -%>" > GATEWAY="<%= subnet.gateway %>" > DEVICE=$real > HWADDR="<%= @host.mac -%>" > ONBOOT=yes > EOF > > I'm not sure it's a good solution but it works !!! >

Hello,

Thanks for your response.
I read this in the manuel but if i select static on boot mode i can't boot
to pxe. Normal or not ?

··· Le mardi 24 mai 2016 23:36:44 UTC+2, Elisiano Petrini a écrit : > > I believe you can control this through the subnet definition. > In the subnet there is a parameter called "Boot mode" which can be either > static or dhcp. > > HTH, Elisiano > > On Tuesday, May 24, 2016 at 2:24:03 PM UTC-4, Benoit Pluchet wrote: >> >> Ok i have change kickstart_networking_setup >> >> to >> >> <%# >> 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 >> %> >> <% subnet = @host.subnet -%> >> <% dhcp = subnet.dhcp_boot_mode? -%> >> # primary interface >> real=`ip -o link | grep <%= @host.mac -%> | awk '{print $2;}' | sed s/://` >> cat < /etc/sysconfig/network-scripts/ifcfg-$real >> BOOTPROTO="none" >> IPADDR="<%= @host.ip -%>" >> NETMASK="<%= subnet.mask -%>" >> GATEWAY="<%= subnet.gateway %>" >> DEVICE=$real >> HWADDR="<%= @host.mac -%>" >> ONBOOT=yes >> EOF >> >> I'm not sure it's a good solution but it works !!! >> >

Foreman 1.11.1 changed this so it no longer creates the DHCP reservation
whenever the boot mode is changed from DHCP. This issue is tracked at
Bug #14905: DHCP reservation for PXE boot not added when using static boot mode - Foreman.

··· -- Dominic Cleal dominic@cleal.org

On 25/05/16 07:59, Benoit Pluchet wrote:

Hello,

Thanks for your response.
I read this in the manuel but if i select static on boot mode i can’t
boot to pxe. Normal or not ?

Le mardi 24 mai 2016 23:36:44 UTC+2, Elisiano Petrini a écrit :

I believe you can control this through the subnet definition.
In the subnet there is a parameter called "Boot mode" which can be
either static or dhcp.

HTH, Elisiano

On Tuesday, May 24, 2016 at 2:24:03 PM UTC-4, Benoit Pluchet wrote:

    Ok i have change kickstart_networking_setup
    <https://172.23.2.26/templates/provisioning_templates/48-kickstart_networking_setup/edit> to 

    <%#
    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
    %>
    <% subnet = @host.subnet -%>
    <% dhcp = subnet.dhcp_boot_mode? -%>
    # primary interface
    real=`ip -o link | grep <%= @host.mac -%> | awk '{print $2;}' |
    sed s/://`
    cat << EOF > /etc/sysconfig/network-scripts/ifcfg-$real
    BOOTPROTO="none"
    IPADDR="<%= @host.ip -%>"
    NETMASK="<%= subnet.mask -%>"
    GATEWAY="<%= subnet.gateway %>"
    DEVICE=$real
    HWADDR="<%= @host.mac -%>"
    ONBOOT=yes
    EOF

    I'm not sure it's a good solution but it works !!!


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
mailto:foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com
mailto: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.

Ok very good, thanks.

Where can I find the 1.11.3 ?

and i have find, i think, an another bug.
When i configure provisionning the option
foreman-proxy-dns-reverse=0.2.23.172.in-addr.arpa, I think this should be --foreman-proxy-dns-reverse=2.23.172.in-addr.arpa,
no ?

··· Le mercredi 25 mai 2016 09:15:09 UTC+2, Dominic Cleal a écrit : > > Foreman 1.11.1 changed this so it no longer creates the DHCP reservation > whenever the boot mode is changed from DHCP. This issue is tracked at > http://projects.theforeman.org/issues/14905. > > -- > Dominic Cleal > dom...@cleal.org > > On 25/05/16 07:59, Benoit Pluchet wrote: > > Hello, > > > > Thanks for your response. > > I read this in the manuel but if i select static on boot mode i can't > > boot to pxe. Normal or not ? > > > > > > Le mardi 24 mai 2016 23:36:44 UTC+2, Elisiano Petrini a écrit : > > > > I believe you can control this through the subnet definition. > > In the subnet there is a parameter called "Boot mode" which can be > > either static or dhcp. > > > > HTH, Elisiano > > > > On Tuesday, May 24, 2016 at 2:24:03 PM UTC-4, Benoit Pluchet wrote: > > > > Ok i have change kickstart_networking_setup > > < > https://172.23.2.26/templates/provisioning_templates/48-kickstart_networking_setup/edit> > to > > > > <%# > > 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 > > %> > > <% subnet = @host.subnet -%> > > <% dhcp = subnet.dhcp_boot_mode? -%> > > # primary interface > > real=`ip -o link | grep <%= @host.mac -%> | awk '{print $2;}' | > > sed s/://` > > cat < /etc/sysconfig/network-scripts/ifcfg-$real > > BOOTPROTO="none" > > IPADDR="<%= @host.ip -%>" > > NETMASK="<%= subnet.mask -%>" > > GATEWAY="<%= subnet.gateway %>" > > DEVICE=$real > > HWADDR="<%= @host.mac -%>" > > ONBOOT=yes > > EOF > > > > I'm not sure it's a good solution but it works !!! > > > > -- > > 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 > > <mailto:foreman-users+unsubscribe@googlegroups.com >. > > To post to this group, send email to forema...@googlegroups.com > > > <mailto:forema...@googlegroups.com >. > > Visit this group at https://groups.google.com/group/foreman-users. > > For more options, visit https://groups.google.com/d/optout. > >

> Ok very good, thanks.
>
> Where can I find the 1.11.3 ?

1.11.3 isn't released, see
Foreman 111 Schedule - Foreman.
The ticket is "New", it isn't been solved and may not even be in the
release if nobody steps forward to fix it.

> and i have find, i think, an another bug.
> When i configure provisionning the option
> foreman-proxy-dns-reverse=0.2.23.172.in-addr.arpa, I think this should
> be --foreman-proxy-dns-reverse=2.23.172.in-addr.arpa, no ?

It depends also on the value of the subnet mask. The code probably
doesn't work for networks divided into anything other than old-style
class A/B/C increments, so if your subnet mask's anything other than
255.255.255.0 for a /24, then this might indeed happen.

··· On 25/05/16 09:18, Benoit Pluchet wrote:


Dominic Cleal
dominic@cleal.org

Thank you very much.
You are right, i use this subnet mask : 255.255.255.192, then I change it
manually, --foreman-proxy-dns-reverse=2.23.172.in-addr.arpa and it works.

··· Le mercredi 25 mai 2016 10:24:35 UTC+2, Dominic Cleal a écrit : > > On 25/05/16 09:18, Benoit Pluchet wrote: > > Ok very good, thanks. > > > > Where can I find the 1.11.3 ? > > 1.11.3 isn't released, see > http://projects.theforeman.org/projects/foreman/wiki/Foreman_111_Schedule. > > The ticket is "New", it isn't been solved and may not even be in the > release if nobody steps forward to fix it. > > > and i have find, i think, an another bug. > > When i configure provisionning the option > > foreman-proxy-dns-reverse=0.2.23.172.in-addr.arpa, I think this should > > be --foreman-proxy-dns-reverse=2.23.172.in-addr.arpa, no ? > > It depends also on the value of the subnet mask. The code probably > doesn't work for networks divided into anything other than old-style > class A/B/C increments, so if your subnet mask's anything other than > 255.255.255.0 for a /24, then this might indeed happen. > > -- > Dominic Cleal > dom...@cleal.org >