foreman_bootdisk 1.2.3 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES.md +5 -0
- data/README.md +17 -10
- data/app/controllers/bootdisk/disks_controller.rb +9 -1
- data/app/controllers/concerns/bootdisk/hosts_controller_ext.rb +9 -1
- data/app/helpers/concerns/bootdisk/hosts_helper_ext.rb +1 -1
- data/app/models/concerns/bootdisk/config_template_ext.rb +1 -1
- data/app/models/setting/bootdisk.rb +2 -2
- data/app/views/bootdisk/{generic_host_v1.erb → generic_host.erb} +1 -1
- data/app/views/bootdisk/{host_v3.erb → host.erb} +9 -1
- data/db/migrate/20130914211030_create_host_bootdisk_template.rb +1 -8
- data/db/migrate/20130915104500_edit_host_bootdisk_template_multinic.rb +0 -4
- data/db/migrate/20130915133321_create_kickstart_bootdisk_template.rb +0 -7
- data/db/migrate/20130915201457_create_generic_host_bootdisk_template.rb +1 -8
- data/db/migrate/20131021095100_edit_host_bootdisk_template_dns_secondary.rb +0 -4
- data/db/seeds.rb +22 -0
- data/lib/bootdisk/engine.rb +19 -0
- data/lib/bootdisk/version.rb +1 -1
- metadata +6 -9
- data/app/views/bootdisk/host_v1.erb +0 -21
- data/app/views/bootdisk/host_v2.erb +0 -38
- data/app/views/bootdisk/kickstart_v1.erb +0 -5
- data/config/initializers/bootdisk_permissions.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: efc889edd64e77c31e018006515a86f9cdd68b58
|
4
|
+
data.tar.gz: 48185eb7638eab87a12853792dd2fc226e6adcb0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1341fd44db6ff7d68060bd6129eef80fb50d4e530ba730f93d14c7cf3dcb05e5686b6485605fef25df036e41ffe30bb73253cd6c90dd2db53df8b5edc7d42852
|
7
|
+
data.tar.gz: 9abfa6c19bdc36bdc67c865a6867be88c2b8a625948ed6948db977e1cb832bc1d5efee537c64077775a0ba4fbf870d2f341df72799852ad4cb6ce8467e9d1650
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v2.0.0
|
4
|
+
* compatible with Foreman 1.4 (only), uses new plugin registration system
|
5
|
+
* add validation of host and subnet data to host template
|
6
|
+
* remove kickstart iPXE, use the one supplied in Foreman 1.4
|
7
|
+
|
3
8
|
## v1.2.3
|
4
9
|
* remove secondary DNS server from iPXE template (#3558)
|
5
10
|
|
data/README.md
CHANGED
@@ -27,14 +27,20 @@ RPM users can install the "ruby193-rubygem-foreman_bootdisk" or
|
|
27
27
|
* syslinux is required
|
28
28
|
* mkisofs and isohybrid are required
|
29
29
|
|
30
|
-
gPXE images are unsupported due to lack of initrd support
|
31
|
-
|
30
|
+
gPXE images are unsupported due to lack of initrd support.
|
31
|
+
|
32
|
+
## Compatibility
|
33
|
+
|
34
|
+
| Foreman Version | Plugin Version |
|
35
|
+
| --------------- | --------------:|
|
36
|
+
| <= 1.3 | ~> 1.0 |
|
37
|
+
| >= 1.4 | ~> 2.0 |
|
32
38
|
|
33
39
|
# Usage
|
34
40
|
|
35
41
|
## Configuration
|
36
42
|
|
37
|
-
Some configuration is set under
|
43
|
+
Some configuration is set under Administer>Settings>Bootdisk in the Foreman UI.
|
38
44
|
|
39
45
|
* `bootdisk_ipxe_dir` points to the directory containing ipxe.lkrn
|
40
46
|
* `bootdisk_syslinux_dir` points to the directory containing syslinux images
|
@@ -43,7 +49,7 @@ Some configuration is set under More>Settings>Bootdisk in the Foreman UI.
|
|
43
49
|
|
44
50
|
For per-host images, ensure host IP addresses and subnets are populated, and
|
45
51
|
the subnet's gateway, subnet mask and DNS resolver(s) are correctly configured
|
46
|
-
under
|
52
|
+
under Infrastructure>Subnets in Foreman.
|
47
53
|
|
48
54
|
To permit access to images for non-admin users, add the "Boot disk access" role
|
49
55
|
to a user or the "download_bootdisk" permission to an existing role.
|
@@ -52,12 +58,11 @@ to a user or the "download_bootdisk" permission to an existing role.
|
|
52
58
|
|
53
59
|
The templates used on the boot disks themselves are read-only so they can be
|
54
60
|
updated in new versions of the plugin. To customise, copy the contents to a
|
55
|
-
new template and set the name in
|
61
|
+
new template and set the name in Administer>Settings>Bootdisk.
|
56
62
|
|
57
|
-
An OS
|
58
|
-
|
59
|
-
|
60
|
-
on the OS.
|
63
|
+
An OS iPXE provisioning template is required, preferably "Kickstart default
|
64
|
+
iPXE". Ensure the OSes are ticked under the Associations tab and that the
|
65
|
+
iPXE template is selected under the Templates tab on the OS.
|
61
66
|
|
62
67
|
Lastly, the OS provision template (i.e. kickstart/preseed) should provide the
|
63
68
|
static IP details required to configure the OS. For a kickstart file, the
|
@@ -65,6 +70,8 @@ following configuration will do this:
|
|
65
70
|
|
66
71
|
network --bootproto <%= @static ? "static" : "dhcp" %> --hostname <%= @host %> <%= "--ip=#{@host.ip} --netmask=#{@host.subnet.mask} --gateway=#{@host.subnet.gateway} --nameserver=#{@host.subnet.dns_primary},#{@host.subnet.dns_secondary}" if @static %>
|
67
72
|
|
73
|
+
Foreman's default kickstart file is ready to use.
|
74
|
+
|
68
75
|
## Available images
|
69
76
|
|
70
77
|
The image types have trade-offs, but are all meant for environments without
|
@@ -119,7 +126,7 @@ It will boot and contact Foreman for template of a registered host matching a
|
|
119
126
|
MAC address or the IP the host was assigned by DHCP.
|
120
127
|
|
121
128
|
The installation can continue on either the DHCP or static IP depending on how
|
122
|
-
the OS
|
129
|
+
the OS iPXE template is configured, and could configure the assigned IP
|
123
130
|
address statically for the installed system via the kickstart file.
|
124
131
|
|
125
132
|
To generate the image from the web interface, view a host page, click the
|
@@ -1,7 +1,15 @@
|
|
1
1
|
module Bootdisk
|
2
2
|
class DisksController < ::ApplicationController
|
3
3
|
def generic_iso
|
4
|
-
|
4
|
+
begin
|
5
|
+
tmpl = Bootdisk::Renderer.new.generic_template_render
|
6
|
+
rescue => e
|
7
|
+
error _('Failed to render boot disk template: %s') % e
|
8
|
+
redirect_to :back
|
9
|
+
return
|
10
|
+
end
|
11
|
+
|
12
|
+
Bootdisk::ISOGenerator.new(tmpl).generate do |iso|
|
5
13
|
send_data File.read(iso), :filename => "bootdisk_#{Setting[:foreman_url]}.iso"
|
6
14
|
end
|
7
15
|
end
|
@@ -7,7 +7,15 @@ module Bootdisk::HostsControllerExt
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def bootdisk_iso
|
10
|
-
|
10
|
+
begin
|
11
|
+
tmpl = @host.bootdisk_template_render
|
12
|
+
rescue => e
|
13
|
+
error _('Failed to render boot disk template: %s') % e
|
14
|
+
redirect_to :back
|
15
|
+
return
|
16
|
+
end
|
17
|
+
|
18
|
+
Bootdisk::ISOGenerator.new(tmpl).generate do |iso|
|
11
19
|
send_data File.read(iso), :filename => "#{@host.name}.iso"
|
12
20
|
end
|
13
21
|
end
|
@@ -8,7 +8,7 @@ module Bootdisk::HostsHelperExt
|
|
8
8
|
def host_title_actions_with_bootdisk(host, vm)
|
9
9
|
title_actions(
|
10
10
|
button_group(
|
11
|
-
select_action_button(_('Boot disk'),
|
11
|
+
select_action_button(_('Boot disk'), {},
|
12
12
|
display_link_if_authorized(_("Host '%s' image") % @host.name.split('.')[0], hash_for_bootdisk_iso_host_path(:id => @host), :class=>'btn'),
|
13
13
|
display_link_if_authorized(_("Generic image"), hash_for_generic_iso_disks_path, :class=>'btn')
|
14
14
|
)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Bootdisk::ConfigTemplateExt
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
|
-
BOOTDISK_TMPLS = ['Boot disk
|
6
|
+
BOOTDISK_TMPLS = ['Boot disk iPXE - host', 'Kickstart boot disk iPXE']
|
7
7
|
|
8
8
|
included do
|
9
9
|
before_destroy :bootdisk_destroy?
|
@@ -10,8 +10,8 @@ class Setting::Bootdisk< ::Setting
|
|
10
10
|
[
|
11
11
|
self.set('bootdisk_ipxe_dir', _('Path to directory containing iPXE images'), ipxe),
|
12
12
|
self.set('bootdisk_syslinux_dir', _('Path to directory containing syslinux images'), syslinux),
|
13
|
-
self.set('bootdisk_host_template', _('
|
14
|
-
self.set('bootdisk_generic_host_template', _('
|
13
|
+
self.set('bootdisk_host_template', _('iPXE template to use for host-specific boot disks'), 'Boot disk iPXE - host'),
|
14
|
+
self.set('bootdisk_generic_host_template', _('iPXE template to use for generic host boot disks'), 'Boot disk iPXE - generic host'),
|
15
15
|
].compact.each { |s| self.create s.update(:category => "Setting::Bootdisk") }
|
16
16
|
end
|
17
17
|
|
@@ -15,7 +15,7 @@
|
|
15
15
|
isset ${net<%= i -%>/mac} || goto no_nic
|
16
16
|
echo net<%= i -%> is a ${net<%= i -%>/chip} with MAC ${net<%= i -%>/mac}
|
17
17
|
dhcp net<%= i %> || goto net<%= i+1 %>
|
18
|
-
chain <%= (u = URI.parse(foreman_url("
|
18
|
+
chain <%= (u = URI.parse(foreman_url("iPXE")); u.query = "#{u.query}&mac="; u.to_s) %>${net<%= i -%>/mac} || goto net<%= i+1 %>
|
19
19
|
exit 0
|
20
20
|
<% end -%>
|
21
21
|
|
@@ -4,6 +4,14 @@
|
|
4
4
|
#
|
5
5
|
# Copy this template to customize it, the original is read-only.
|
6
6
|
|
7
|
+
<%
|
8
|
+
raise ::Foreman::Exception.new(N_('Host has no IP address defined')) if @host.ip.empty?
|
9
|
+
raise ::Foreman::Exception.new(N_('Host has no subnet defined')) if @host.subnet.nil?
|
10
|
+
raise ::Foreman::Exception.new(N_('Host has no domain defined')) if @host.domain.nil?
|
11
|
+
raise ::Foreman::Exception.new(N_('Subnet (%s) has no gateway defined'), @host.subnet) if @host.subnet.gateway.empty?
|
12
|
+
raise ::Foreman::Exception.new(N_('Subnet (%s) has no primary DNS server defined'), @host.subnet) if @host.subnet.dns_primary.empty?
|
13
|
+
%>
|
14
|
+
|
7
15
|
# loop over net* until the host's MAC matches
|
8
16
|
<% (0..32).each do |i| -%>
|
9
17
|
:net<%= i %>
|
@@ -29,7 +37,7 @@ set domain <%= @host.domain.to_s %>
|
|
29
37
|
|
30
38
|
# Chainload from Foreman rather than embedding OS info here, so the behaviour
|
31
39
|
# is entirely dynamic.
|
32
|
-
chain <%= foreman_url("
|
40
|
+
chain <%= foreman_url("iPXE") %>
|
33
41
|
exit 0
|
34
42
|
|
35
43
|
:no_nic
|
@@ -1,14 +1,7 @@
|
|
1
1
|
class CreateHostBootdiskTemplate < ActiveRecord::Migration
|
2
2
|
def self.up
|
3
|
-
ConfigTemplate.find_or_create_by_name(
|
4
|
-
:name => 'Boot disk gPXE - host',
|
5
|
-
:template_kind_id => TemplateKind.find_by_name('gPXE').try(:id),
|
6
|
-
:snippet => false,
|
7
|
-
:template => File.read(File.join(Bootdisk::Engine.root, 'app', 'views', 'bootdisk', 'host_v1.erb'))
|
8
|
-
)
|
9
3
|
end
|
10
|
-
|
4
|
+
|
11
5
|
def self.down
|
12
|
-
ConfigTemplate.destroy_all(:name => 'Boot disk gPXE - host')
|
13
6
|
end
|
14
7
|
end
|
@@ -1,11 +1,7 @@
|
|
1
1
|
class EditHostBootdiskTemplateMultinic < ActiveRecord::Migration
|
2
2
|
def self.up
|
3
|
-
ConfigTemplate.find_by_name('Boot disk gPXE - host').update_attribute(
|
4
|
-
:template, File.read(File.join(Bootdisk::Engine.root, 'app', 'views', 'bootdisk', 'host_v2.erb')))
|
5
3
|
end
|
6
4
|
|
7
5
|
def self.down
|
8
|
-
ConfigTemplate.find_by_name('Boot disk gPXE - host').update_attribute(
|
9
|
-
:template, File.read(File.join(Bootdisk::Engine.root, 'app', 'views', 'bootdisk', 'host_v1.erb')))
|
10
6
|
end
|
11
7
|
end
|
@@ -1,14 +1,7 @@
|
|
1
1
|
class CreateKickstartBootdiskTemplate < ActiveRecord::Migration
|
2
2
|
def self.up
|
3
|
-
ConfigTemplate.find_or_create_by_name(
|
4
|
-
:name => 'Kickstart boot disk gPXE',
|
5
|
-
:template_kind_id => TemplateKind.find_by_name('gPXE').try(:id),
|
6
|
-
:snippet => false,
|
7
|
-
:template => File.read(File.join(Bootdisk::Engine.root, 'app', 'views', 'bootdisk', 'kickstart_v1.erb'))
|
8
|
-
)
|
9
3
|
end
|
10
4
|
|
11
5
|
def self.down
|
12
|
-
ConfigTemplate.destroy_all(:name => 'Kickstart boot disk gPXE')
|
13
6
|
end
|
14
7
|
end
|
@@ -1,14 +1,7 @@
|
|
1
1
|
class CreateGenericHostBootdiskTemplate < ActiveRecord::Migration
|
2
2
|
def self.up
|
3
|
-
ConfigTemplate.find_or_create_by_name(
|
4
|
-
:name => 'Boot disk gPXE - generic host',
|
5
|
-
:template_kind_id => TemplateKind.find_by_name('gPXE').try(:id),
|
6
|
-
:snippet => false,
|
7
|
-
:template => File.read(File.join(Bootdisk::Engine.root, 'app', 'views', 'bootdisk', 'generic_host_v1.erb'))
|
8
|
-
)
|
9
3
|
end
|
10
|
-
|
4
|
+
|
11
5
|
def self.down
|
12
|
-
ConfigTemplate.destroy_all(:name => 'Boot disk gPXE - generic host')
|
13
6
|
end
|
14
7
|
end
|
@@ -1,11 +1,7 @@
|
|
1
1
|
class EditHostBootdiskTemplateDnsSecondary < ActiveRecord::Migration
|
2
2
|
def self.up
|
3
|
-
ConfigTemplate.find_by_name('Boot disk gPXE - host').update_attribute(
|
4
|
-
:template, File.read(File.join(Bootdisk::Engine.root, 'app', 'views', 'bootdisk', 'host_v3.erb')))
|
5
3
|
end
|
6
4
|
|
7
5
|
def self.down
|
8
|
-
ConfigTemplate.find_by_name('Boot disk gPXE - host').update_attribute(
|
9
|
-
:template, File.read(File.join(Bootdisk::Engine.root, 'app', 'views', 'bootdisk', 'host_v2.erb')))
|
10
6
|
end
|
11
7
|
end
|
data/db/seeds.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
def format_errors(model = nil)
|
2
|
+
return '(nil found)' if model.nil?
|
3
|
+
model.errors.full_messages.join(';')
|
4
|
+
end
|
5
|
+
|
6
|
+
ConfigTemplate.without_auditing do
|
7
|
+
content = File.read(File.join(Bootdisk::Engine.root, 'app', 'views', 'bootdisk', 'host.erb'))
|
8
|
+
ConfigTemplate.find_or_create_by_name(
|
9
|
+
:name => 'Boot disk iPXE - host',
|
10
|
+
:template_kind_id => TemplateKind.find_by_name('iPXE').try(:id),
|
11
|
+
:snippet => false,
|
12
|
+
:template => content
|
13
|
+
).update_attribute(:template, content)
|
14
|
+
|
15
|
+
content = File.read(File.join(Bootdisk::Engine.root, 'app', 'views', 'bootdisk', 'generic_host.erb'))
|
16
|
+
ConfigTemplate.find_or_create_by_name(
|
17
|
+
:name => 'Boot disk iPXE - generic host',
|
18
|
+
:template_kind_id => TemplateKind.find_by_name('iPXE').try(:id),
|
19
|
+
:snippet => false,
|
20
|
+
:template => content
|
21
|
+
).update_attribute(:template, content)
|
22
|
+
end
|
data/lib/bootdisk/engine.rb
CHANGED
@@ -16,6 +16,19 @@ module Bootdisk
|
|
16
16
|
app.config.paths['db/migrate'] += Bootdisk::Engine.paths['db/migrate'].existent
|
17
17
|
end
|
18
18
|
|
19
|
+
initializer 'my_plugin.register_plugin', :after=> :finisher_hook do |app|
|
20
|
+
Foreman::Plugin.register :foreman_bootdisk do
|
21
|
+
requires_foreman '>= 1.4'
|
22
|
+
|
23
|
+
security_block :bootdisk do |map|
|
24
|
+
permission :download_bootdisk, {:hosts => [:bootdisk_iso],
|
25
|
+
:'bootdisk/disks' => [:generic_iso, :index]}
|
26
|
+
end
|
27
|
+
|
28
|
+
role "Boot disk access", [:download_bootdisk] unless (Role.count rescue nil).nil?
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
19
32
|
config.to_prepare do
|
20
33
|
begin
|
21
34
|
ConfigTemplate.send(:include, Bootdisk::ConfigTemplateExt)
|
@@ -27,5 +40,11 @@ module Bootdisk
|
|
27
40
|
puts "#{Bootdisk::ENGINE_NAME}: skipping engine hook (#{e.to_s})"
|
28
41
|
end
|
29
42
|
end
|
43
|
+
|
44
|
+
rake_tasks do
|
45
|
+
Rake::Task['db:seed'].enhance do
|
46
|
+
Bootdisk::Engine.load_seed
|
47
|
+
end
|
48
|
+
end
|
30
49
|
end
|
31
50
|
end
|
data/lib/bootdisk/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_bootdisk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dominic Cleal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Plugin for Foreman that creates iPXE-based boot disks to provision hosts
|
14
14
|
without the need for PXE infrastructure.
|
@@ -32,18 +32,15 @@ files:
|
|
32
32
|
- app/models/setting/bootdisk.rb
|
33
33
|
- app/services/bootdisk/iso_generator.rb
|
34
34
|
- app/services/bootdisk/renderer.rb
|
35
|
-
- app/views/bootdisk/
|
36
|
-
- app/views/bootdisk/
|
37
|
-
- app/views/bootdisk/host_v2.erb
|
38
|
-
- app/views/bootdisk/host_v3.erb
|
39
|
-
- app/views/bootdisk/kickstart_v1.erb
|
40
|
-
- config/initializers/bootdisk_permissions.rb
|
35
|
+
- app/views/bootdisk/generic_host.erb
|
36
|
+
- app/views/bootdisk/host.erb
|
41
37
|
- config/routes.rb
|
42
38
|
- db/migrate/20130914211030_create_host_bootdisk_template.rb
|
43
39
|
- db/migrate/20130915104500_edit_host_bootdisk_template_multinic.rb
|
44
40
|
- db/migrate/20130915133321_create_kickstart_bootdisk_template.rb
|
45
41
|
- db/migrate/20130915201457_create_generic_host_bootdisk_template.rb
|
46
42
|
- db/migrate/20131021095100_edit_host_bootdisk_template_dns_secondary.rb
|
43
|
+
- db/seeds.rb
|
47
44
|
- lib/bootdisk/engine.rb
|
48
45
|
- lib/bootdisk/version.rb
|
49
46
|
- lib/foreman_bootdisk.rb
|
@@ -68,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
65
|
version: '0'
|
69
66
|
requirements: []
|
70
67
|
rubyforge_project:
|
71
|
-
rubygems_version: 2.0.
|
68
|
+
rubygems_version: 2.0.6
|
72
69
|
signing_key:
|
73
70
|
specification_version: 4
|
74
71
|
summary: Create boot disks to provision hosts with Foreman
|
@@ -1,21 +0,0 @@
|
|
1
|
-
#!ipxe
|
2
|
-
# Example foreman_bootdisk host template
|
3
|
-
# This template is rendered for use inside a host-specific boot disk.
|
4
|
-
#
|
5
|
-
# Copy this template to customize it, the original is read-only.
|
6
|
-
|
7
|
-
# TODO: loop over net* until the host's MAC matches
|
8
|
-
ifopen net0
|
9
|
-
set net0/ip <%= @host.ip %>
|
10
|
-
set net0/netmask <%= @host.subnet.mask %>
|
11
|
-
set net0/gateway <%= @host.subnet.gateway %>
|
12
|
-
route
|
13
|
-
|
14
|
-
# Note, iPXE can only use one DNS server
|
15
|
-
set dns <%= @host.subnet.dns_primary %> <%= @host.subnet.dns_secondary %>
|
16
|
-
set net0/dns ${dns}
|
17
|
-
set domain <%= @host.domain.to_s %>
|
18
|
-
|
19
|
-
# Chainload from Foreman rather than embedding OS info here, so the behaviour
|
20
|
-
# is entirely dynamic.
|
21
|
-
chain <%= foreman_url("gPXE") %>
|
@@ -1,38 +0,0 @@
|
|
1
|
-
#!ipxe
|
2
|
-
# Example foreman_bootdisk host template
|
3
|
-
# This template is rendered for use inside a host-specific boot disk.
|
4
|
-
#
|
5
|
-
# Copy this template to customize it, the original is read-only.
|
6
|
-
|
7
|
-
# loop over net* until the host's MAC matches
|
8
|
-
<% (0..32).each do |i| -%>
|
9
|
-
:net<%= i %>
|
10
|
-
isset ${net<%= i -%>/mac} || goto no_nic
|
11
|
-
echo net<%= i -%> is a ${net<%= i -%>/chip} with MAC ${net<%= i -%>/mac}
|
12
|
-
iseq ${net<%= i -%>/mac} <%= @host.mac -%> || goto net<%= i+1 %>
|
13
|
-
ifopen net<%= i %>
|
14
|
-
set idx:int32 <%= i %>
|
15
|
-
goto loop_success
|
16
|
-
<% end -%>
|
17
|
-
|
18
|
-
:loop_success
|
19
|
-
echo Configuring net${idx} for static IP address
|
20
|
-
ifopen net${idx}
|
21
|
-
set netX/ip <%= @host.ip %>
|
22
|
-
set netX/netmask <%= @host.subnet.mask %>
|
23
|
-
set netX/gateway <%= @host.subnet.gateway %>
|
24
|
-
route
|
25
|
-
|
26
|
-
# Note, iPXE can only use one DNS server
|
27
|
-
set dns <%= @host.subnet.dns_primary %> <%= @host.subnet.dns_secondary %>
|
28
|
-
set domain <%= @host.domain.to_s %>
|
29
|
-
|
30
|
-
# Chainload from Foreman rather than embedding OS info here, so the behaviour
|
31
|
-
# is entirely dynamic.
|
32
|
-
chain <%= foreman_url("gPXE") %>
|
33
|
-
exit 0
|
34
|
-
|
35
|
-
:no_nic
|
36
|
-
echo Cannot find interface with MAC <%= @host.mac %>
|
37
|
-
sleep 30
|
38
|
-
exit 1
|
@@ -1,5 +0,0 @@
|
|
1
|
-
#!gpxe
|
2
|
-
kernel <%= "#{@host.url_for_boot(:kernel)}" %> ks=<%= foreman_url("provision")%>?static=yes ksdevice=<%= @host.mac %> network kssendmac ip=${netX/ip} netmask=${netX/netmask} gateway=${netX/gateway} dns=${dns}
|
3
|
-
initrd <%= "#{@host.url_for_boot(:initrd)}" %>
|
4
|
-
|
5
|
-
boot
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# Add permissions
|
2
|
-
Foreman::AccessControl.map do |map|
|
3
|
-
map.security_block :bootdisk do |map|
|
4
|
-
map.permission :download_bootdisk, {:hosts => [:bootdisk_iso],
|
5
|
-
:'bootdisk/disks' => [:generic_iso, :index]}
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
begin
|
10
|
-
# Add a new role called 'Boot disk access' if it doesn't exist
|
11
|
-
Role.transaction do
|
12
|
-
role = Role.find_or_create_by_name("Boot disk access")
|
13
|
-
role.update_attribute :permissions, [:download_bootdisk] if role.permissions.empty?
|
14
|
-
end
|
15
|
-
rescue
|
16
|
-
end
|