Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Fix razor ipxe template. #63

Merged
merged 3 commits into from over 1 year ago

2 participants

Nan Liu three18ti
Nan Liu

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?

Nan Liu

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
Nan Liu nanliu merged commit d3d51fe into from October 11, 2012
Nan Liu nanliu closed this October 11, 2012
Nan Liu nanliu referenced this pull request in puppetlabs/Razor October 11, 2012
Closed

RHEL Kickstart hangs with multiple NICs #218

Nan Liu nanliu deleted the branch April 07, 2014
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.
22  manifests/init.pp
@@ -4,7 +4,8 @@
4 4
 #
5 5
 #   [*usename*]: daemon service account, default razor.
6 6
 #   [*directory*]: installation directory, default /opt/razor.
7  
-#   [*address*]: razor.ipxe chain address, and razor service listen address, default: facter ipaddress.
  7
+#   [*address*]: razor.ipxe chain address, and razor service listen address,
  8
+#                default: facter ipaddress.
8 9
 #   [*persist_host*]: ip address of the mongodb server.
9 10
 #   [*mk_checkin_interval*]: mk checkin interval.
10 11
 #   [*mk_name*]: Razor tinycore linux mk name.
@@ -103,8 +104,15 @@
103 104
     status    => "${directory}/bin/razor_daemon.rb status",
104 105
     start     => "${directory}/bin/razor_daemon.rb start",
105 106
     stop      => "${directory}/bin/razor_daemon.rb stop",
106  
-    require   => [ Class['mongodb'], File[$directory], Sudo::Conf['razor'] ],
107  
-    subscribe => [ Class['razor::nodejs'], Vcsrepo[$directory] ],
  107
+    require   => [
  108
+      Class['mongodb'],
  109
+      File[$directory],
  110
+      Sudo::Conf['razor']
  111
+    ],
  112
+    subscribe => [
  113
+      Class['razor::nodejs'],
  114
+      Vcsrepo[$directory]
  115
+    ],
108 116
   }
109 117
 
110 118
   file { '/usr/local/bin/razor':
@@ -112,7 +120,7 @@
112 120
     owner   => '0',
113 121
     group   => '0',
114 122
     mode    => '0755',
115  
-    content => template('razor/razor'),
  123
+    content => template('razor/razor.erb'),
116 124
     require => Vcsrepo[$directory],
117 125
   }
118 126
 
@@ -126,7 +134,11 @@
126 134
     ensure  => present,
127 135
     type    => 'mk',
128 136
     source  => $mk_source,
129  
-    require => [ File['/usr/local/bin/razor'], Package['curl'], Service['razor'] ],
  137
+    require => [
  138
+      File['/usr/local/bin/razor'],
  139
+      Package['curl'],
  140
+      Service['razor']
  141
+    ],
130 142
   }
131 143
 
132 144
   file { "$directory/conf/razor_server.conf":
12  manifests/tftp.pp
@@ -10,11 +10,13 @@
10 10
 
11 11
   include tftp
12 12
 
13  
-  tftp::file { [ 'pxelinux.0',
14  
-                 'menu.c32',
15  
-                 'ipxe.iso',
16  
-                 'ipxe.lkrn',
17  
-                 'undionly.kpxe' ]:
  13
+  tftp::file { [
  14
+    'pxelinux.0',
  15
+    'menu.c32',
  16
+    'ipxe.iso',
  17
+    'ipxe.lkrn',
  18
+    'undionly.kpxe'
  19
+  ]:
18 20
   }
19 21
 
20 22
   tftp::file { 'pxelinux.cfg':
0  templates/razor → templates/razor.erb
File renamed without changes
53  templates/razor.ipxe.erb
... ...
@@ -1,15 +1,48 @@
1 1
 #!ipxe
2 2
 
3  
-isset ${net0/mac} && dhcp net0 ||
4  
-isset ${net1/mac} && dhcp net1 ||
5  
-isset ${net2/mac} && dhcp net2 ||
6  
-isset ${net3/mac} && dhcp net3 ||
7  
-isset ${net4/mac} && dhcp net4 ||
8  
-isset ${net5/mac} && dhcp net5 ||
9  
-isset ${net6/mac} && dhcp net6 ||
10  
-isset ${net7/mac} && dhcp net7 ||
11  
-
12  
-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
  3
+:n0
  4
+isset ${net0/mac} && dhcp net0 || goto n1
  5
+echo net0 has DHCP
  6
+set dhcp_mac 01-${net0/mac:hexhyp}
  7
+
  8
+:n1
  9
+isset ${net1/mac} && dhcp net1 || goto n2
  10
+echo net1 has DHCP
  11
+set dhcp_mac 01-${net1/mac:hexhyp}
  12
+
  13
+:n2
  14
+isset ${net2/mac} && dhcp net2 || goto n3
  15
+echo net2 has DHCP
  16
+set dhcp_mac 01-${net2/mac:hexhyp}
  17
+
  18
+:n3
  19
+isset ${net3/mac} && dhcp net3 || goto n4
  20
+echo net3 has DHCP
  21
+set dhcp_mac 01-${net3/mac:hexhyp}
  22
+
  23
+:n4
  24
+isset ${net4/mac} && dhcp net4 || goto n5
  25
+echo net4 has DHCP
  26
+set dhcp_mac 01-${net4/mac:hexhyp}
  27
+
  28
+:n5
  29
+isset ${net5/mac} && dhcp net5 || goto n6
  30
+echo net5 has DHCP
  31
+set dhcp_mac 01-${net5/mac:hexhyp}
  32
+
  33
+:n6
  34
+isset ${net6/mac} && dhcp net6 || goto n7
  35
+echo net6 has DHCP
  36
+set dhcp_mac 01-${net6/mac:hexhyp}
  37
+
  38
+:n7
  39
+isset ${net7/mac} && dhcp net7 || goto s1
  40
+echo net7 has DHCP
  41
+set dhcp_mac 01-${net7/mac:hexhyp}
  42
+
  43
+
  44
+:s1
  45
+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
13 46
 
14 47
 :error
15 48
 sleep 15
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.