Skip to content
This repository has been archived by the owner on Jun 4, 2021. It is now read-only.

Fix razor ipxe template. #63

Merged
merged 3 commits into from
Oct 11, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -103,16 +104,23 @@
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':
ensure => file,
owner => '0',
group => '0',
mode => '0755',
content => template('razor/razor'),
content => template('razor/razor.erb'),
require => Vcsrepo[$directory],
}

Expand All @@ -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":
Expand Down
12 changes: 7 additions & 5 deletions manifests/tftp.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down
File renamed without changes.
53 changes: 43 additions & 10 deletions templates/razor.ipxe.erb
Original file line number Diff line number Diff line change
@@ -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
Expand Down