Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix razor ipxe template. #63

Merged
merged 3 commits into from

2 participants

@nanliu

Update ipxe template to match recent changes to razor.

@three18ti

Would it be possible to use razor to generate the ipxe confg file? I used the following to generate my ipxe file:

razor ipxe config > /var/lib/tftpboot/razor.ipxe

(annoyingly, the next puppet run, puppet overwrote my razor.ipxe file, so I ran:

roazor ipxe config > /etc/puppet/modules/razor/templates/razor.ipxe.erb

and ran puppet again)

this would eliminate the need to update the template every new razor revision.

Thoughts, Comments, insults?

@nanliu

I will accept a pull request that supports configuration of listening ip address in ipxe and razor config without using templates if it can be done cleanly.

The solution suggested only sort of works if you don't use a puppet master, and the generated config file is not an erb template.

The reason this is currently an erb template is because we need to change the ipaddress for multi-nic systems. The razor ipxe config output is not always correct in those cases.

chain http://<%= address %>

This also needs to be fixed in the razor config file, and deployed conditionally so it's not always triggering a razor service restart on every puppet run.

There was an attempt to support this via execs, but it got rather messy:

exec { "gen_ipxe":
  command => "${directory}/bin/razor config ipxe > ???" # the location is different for different platforms.
  refreshonly => true,
  subscribe => ...,
}

exec { "fix_ipxe":
  command => ..., # sed clean up of ipxe config.
  refreshonly => true,
  subscribe => Exec['gen_ipxe'],
}

exec { "gen_config":
  command => ...,
  refreshonly => true,
  subscribe => ...,
}

exec { "fix_config":
  command => ...,
  refreshonly => true,
  subscribe => Exec['gen_config'],
}
@three18ti
@nanliu nanliu merged commit d3d51fe into from
@nanliu nanliu referenced this pull request in puppetlabs/Razor
Closed

RHEL Kickstart hangs with multiple NICs #218

@nanliu nanliu deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
22 manifests/init.pp
@@ -4,7 +4,8 @@
#
# [*usename*]: daemon service account, default razor.
# [*directory*]: installation directory, default /opt/razor.
-# [*address*]: razor.ipxe chain address, and razor service listen address, default: facter ipaddress.
+# [*address*]: razor.ipxe chain address, and razor service listen address,
+# default: facter ipaddress.
# [*persist_host*]: ip address of the mongodb server.
# [*mk_checkin_interval*]: mk checkin interval.
# [*mk_name*]: Razor tinycore linux mk name.
@@ -103,8 +104,15 @@
status => "${directory}/bin/razor_daemon.rb status",
start => "${directory}/bin/razor_daemon.rb start",
stop => "${directory}/bin/razor_daemon.rb stop",
- require => [ Class['mongodb'], File[$directory], Sudo::Conf['razor'] ],
- subscribe => [ Class['razor::nodejs'], Vcsrepo[$directory] ],
+ require => [
+ Class['mongodb'],
+ File[$directory],
+ Sudo::Conf['razor']
+ ],
+ subscribe => [
+ Class['razor::nodejs'],
+ Vcsrepo[$directory]
+ ],
}
file { '/usr/local/bin/razor':
@@ -112,7 +120,7 @@
owner => '0',
group => '0',
mode => '0755',
- content => template('razor/razor'),
+ content => template('razor/razor.erb'),
require => Vcsrepo[$directory],
}
@@ -126,7 +134,11 @@
ensure => present,
type => 'mk',
source => $mk_source,
- require => [ File['/usr/local/bin/razor'], Package['curl'], Service['razor'] ],
+ require => [
+ File['/usr/local/bin/razor'],
+ Package['curl'],
+ Service['razor']
+ ],
}
file { "$directory/conf/razor_server.conf":
View
12 manifests/tftp.pp
@@ -10,11 +10,13 @@
include tftp
- tftp::file { [ 'pxelinux.0',
- 'menu.c32',
- 'ipxe.iso',
- 'ipxe.lkrn',
- 'undionly.kpxe' ]:
+ tftp::file { [
+ 'pxelinux.0',
+ 'menu.c32',
+ 'ipxe.iso',
+ 'ipxe.lkrn',
+ 'undionly.kpxe'
+ ]:
}
tftp::file { 'pxelinux.cfg':
View
0  templates/razor → templates/razor.erb
File renamed without changes
View
53 templates/razor.ipxe.erb
@@ -1,15 +1,48 @@
#!ipxe
-isset ${net0/mac} && dhcp net0 ||
-isset ${net1/mac} && dhcp net1 ||
-isset ${net2/mac} && dhcp net2 ||
-isset ${net3/mac} && dhcp net3 ||
-isset ${net4/mac} && dhcp net4 ||
-isset ${net5/mac} && dhcp net5 ||
-isset ${net6/mac} && dhcp net6 ||
-isset ${net7/mac} && dhcp net7 ||
-
-chain http://<%= @address %>:8026/razor/api/boot?hw_id=${net0/mac}_${net1/mac}_${net2/mac}_${net3/mac}_${net4/mac}_${net5/mac}_${net6/mac}_${net7/mac} || goto error
+:n0
+isset ${net0/mac} && dhcp net0 || goto n1
+echo net0 has DHCP
+set dhcp_mac 01-${net0/mac:hexhyp}
+
+:n1
+isset ${net1/mac} && dhcp net1 || goto n2
+echo net1 has DHCP
+set dhcp_mac 01-${net1/mac:hexhyp}
+
+:n2
+isset ${net2/mac} && dhcp net2 || goto n3
+echo net2 has DHCP
+set dhcp_mac 01-${net2/mac:hexhyp}
+
+:n3
+isset ${net3/mac} && dhcp net3 || goto n4
+echo net3 has DHCP
+set dhcp_mac 01-${net3/mac:hexhyp}
+
+:n4
+isset ${net4/mac} && dhcp net4 || goto n5
+echo net4 has DHCP
+set dhcp_mac 01-${net4/mac:hexhyp}
+
+:n5
+isset ${net5/mac} && dhcp net5 || goto n6
+echo net5 has DHCP
+set dhcp_mac 01-${net5/mac:hexhyp}
+
+:n6
+isset ${net6/mac} && dhcp net6 || goto n7
+echo net6 has DHCP
+set dhcp_mac 01-${net6/mac:hexhyp}
+
+:n7
+isset ${net7/mac} && dhcp net7 || goto s1
+echo net7 has DHCP
+set dhcp_mac 01-${net7/mac:hexhyp}
+
+
+:s1
+chain http://<%= @address %>:8026/razor/api/boot?hw_id=${net0/mac}_${net1/mac}_${net2/mac}_${net3/mac}_${net4/mac}_${net5/mac}_${net6/mac}_${net7/mac}&dhcp_mac=${dhcp_mac} || goto error
:error
sleep 15
Something went wrong with that request. Please try again.