foreman_setup 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGES.md +4 -0
- data/LICENSE +619 -0
- data/README.md +47 -0
- data/app/assets/javascripts/foreman_setup/provisioner.js +13 -0
- data/app/controllers/foreman_setup/provisioners_controller.rb +206 -0
- data/app/helpers/concerns/foreman_setup/home_helper_ext.rb +15 -0
- data/app/helpers/foreman_setup/provisioner_helper.rb +14 -0
- data/app/models/foreman_setup/provisioner.rb +77 -0
- data/app/overrides/add_dashboard_provisioners_link.rb +12 -0
- data/app/overrides/remove_subnet_domains.rb +9 -0
- data/app/overrides/remove_subnet_proxies.rb +9 -0
- data/app/views/foreman_setup/provisioners/_step1.html.erb +45 -0
- data/app/views/foreman_setup/provisioners/_step2.html.erb +19 -0
- data/app/views/foreman_setup/provisioners/_step3.html.erb +58 -0
- data/app/views/foreman_setup/provisioners/_step4.html.erb +49 -0
- data/app/views/foreman_setup/provisioners/_step5.html.erb +22 -0
- data/app/views/foreman_setup/provisioners/index.html.erb +23 -0
- data/app/views/foreman_setup/provisioners/new.html.erb +3 -0
- data/app/views/foreman_setup/provisioners/step2.html.erb +3 -0
- data/app/views/foreman_setup/provisioners/step3.html.erb +3 -0
- data/app/views/foreman_setup/provisioners/step4.html.erb +3 -0
- data/app/views/foreman_setup/provisioners/step5.html.erb +3 -0
- data/config/routes.rb +15 -0
- data/db/migrate/20131023140100_add_provisioners.rb +11 -0
- data/db/migrate/20131025180600_add_provisioners_hostgroup.rb +5 -0
- data/db/migrate/20131028161000_add_provisioners_domain.rb +5 -0
- data/lib/foreman_setup.rb +7 -0
- data/lib/foreman_setup/engine.rb +37 -0
- data/lib/foreman_setup/version.rb +3 -0
- metadata +89 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
|
2
|
+
<%= form_for provisioner, :url => step2_update_foreman_setup_provisioner_path do |f| %>
|
3
|
+
<%= base_errors_for provisioner %>
|
4
|
+
<%= provisioner_wizard 2 %>
|
5
|
+
|
6
|
+
<p>
|
7
|
+
<%= _("To provision hosts, some configuration values are needed for the provisioning subnet attached to the Foreman server.") %>
|
8
|
+
</p>
|
9
|
+
|
10
|
+
<h4><%= _("Domain") %></h4>
|
11
|
+
<%= text_f f, :domain_name, :label => s_("Domain|Name"), :help_inline => _("The DNS domain name to provision hosts into") %>
|
12
|
+
|
13
|
+
<h4><%= _("Subnet") %></h4>
|
14
|
+
<%= f.fields_for :subnet, f.object.subnet do |sf| %>
|
15
|
+
<%= render 'subnets/fields', :f => sf %>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<%= submit_or_cancel f, false, {:cancel_path => foreman_setup_provisioners_path, :disabled => !(f.object.host.present? && f.object.smart_proxy.present?)} %>
|
19
|
+
<% end %>
|
@@ -0,0 +1,58 @@
|
|
1
|
+
|
2
|
+
<div class="well">
|
3
|
+
<%= provisioner_wizard 3 %>
|
4
|
+
|
5
|
+
<p>
|
6
|
+
<%= _("All of the necessary network information has been collected, now run the Foreman installer again with the necessary arguments to configure provisioning.") %>
|
7
|
+
</p>
|
8
|
+
|
9
|
+
<h4><%= _("Install provisioning with DHCP") %></h4>
|
10
|
+
<div>
|
11
|
+
<pre>
|
12
|
+
foreman-installer \
|
13
|
+
--enable-foreman-proxy \
|
14
|
+
--foreman-proxy-tftp=true \
|
15
|
+
--foreman-proxy-tftp-servername=<%= provisioner.provision_interface_data[:ip] %> \
|
16
|
+
--foreman-proxy-dhcp=true \
|
17
|
+
--foreman-proxy-dhcp-interface=<%= provisioner.provision_interface %> \
|
18
|
+
--foreman-proxy-dhcp-gateway=<%= provisioner.subnet.gateway %> \
|
19
|
+
--foreman-proxy-dhcp-range="<%= provisioner.subnet.from %> <%= provisioner.subnet.to %>" \
|
20
|
+
--foreman-proxy-dhcp-nameservers="<%= provisioner.subnet.dns_primary %><%= ("," + provisioner.subnet.dns_secondary) unless provisioner.subnet.dns_secondary.blank? %>" \
|
21
|
+
--foreman-proxy-dns=true \
|
22
|
+
--foreman-proxy-dns-interface=<%= provisioner.provision_interface %> \
|
23
|
+
--foreman-proxy-dns-zone=<%= provisioner.domain.name %> \
|
24
|
+
--foreman-proxy-dns-reverse=<%= provisioner.rdns_zone %> \
|
25
|
+
<%= provisioner.dns_forwarders.map { |f| " --foreman-proxy-dns-forwarders=#{f} \\" }.join("\n") %>
|
26
|
+
--foreman-proxy-foreman-base-url=<%= root_url(:only_path => false).chomp('/') %> \
|
27
|
+
--foreman-proxy-oauth-consumer-key=<%= Setting[:oauth_consumer_key] %> \
|
28
|
+
--foreman-proxy-oauth-consumer-secret=<%= Setting[:oauth_consumer_secret] %>
|
29
|
+
</pre>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
<h4><%= _("Install provisioning without DHCP") %></h4>
|
33
|
+
<div>
|
34
|
+
<pre>
|
35
|
+
foreman-installer \
|
36
|
+
--enable-foreman-proxy \
|
37
|
+
--foreman-proxy-tftp=true \
|
38
|
+
--foreman-proxy-tftp-servername=<%= provisioner.provision_interface_data[:ip] %> \
|
39
|
+
--foreman-proxy-dns=true \
|
40
|
+
--foreman-proxy-dns-interface=<%= provisioner.provision_interface %> \
|
41
|
+
--foreman-proxy-dns-zone=<%= provisioner.domain.name %> \
|
42
|
+
--foreman-proxy-dns-reverse=<%= provisioner.rdns_zone %> \
|
43
|
+
<%= provisioner.dns_forwarders.map { |f| " --foreman-proxy-dns-forwarders=#{f} \\" }.join("\n") %>
|
44
|
+
--foreman-proxy-foreman-base-url=<%= root_url(:only_path => false).chomp('/') %> \
|
45
|
+
--foreman-proxy-oauth-consumer-key=<%= Setting[:oauth_consumer_key] %> \
|
46
|
+
--foreman-proxy-oauth-consumer-secret=<%= Setting[:oauth_consumer_secret] %>
|
47
|
+
</pre>
|
48
|
+
</div>
|
49
|
+
|
50
|
+
<%=
|
51
|
+
content_tag(:div, :class => "form-actions") do
|
52
|
+
content_tag(:div) do
|
53
|
+
link_to(_("Next"), step4_foreman_setup_provisioner_path, :class => "btn btn-primary", :method => :post)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
%>
|
57
|
+
|
58
|
+
</div>
|
@@ -0,0 +1,49 @@
|
|
1
|
+
<%= javascript 'foreman_setup/provisioner' %>
|
2
|
+
|
3
|
+
<%= form_for provisioner, :url => step4_update_foreman_setup_provisioner_path do |f| %>
|
4
|
+
<%= base_errors_for provisioner %>
|
5
|
+
<%= provisioner_wizard 4 %>
|
6
|
+
|
7
|
+
<p>
|
8
|
+
<%= _("Some information about the location of installation media for the operating system used for provisioning is now required.") %>
|
9
|
+
</p>
|
10
|
+
|
11
|
+
<p>
|
12
|
+
<%= _("If installation media has already been set up, it can be selected below and the wizard will complete the necessary associations. Otherwise use the fields below, or the Installation Media page in Foreman to add new media.") %>
|
13
|
+
</p>
|
14
|
+
|
15
|
+
<h4><%= _("Operating system") %></h4>
|
16
|
+
<p><%= _("The following operating system will be configured for provisioning:") %></p>
|
17
|
+
<%= (icon(f.object.host.os, :size => "18x18") + " #{f.object.host.os}").html_safe %>
|
18
|
+
|
19
|
+
<h6><%= _("Use an existing installation medium") %></h6>
|
20
|
+
<%= f.fields_for :hostgroup do |hgf| %>
|
21
|
+
<%= select_f hgf, :medium_id, Medium.all, :id, :name, {:include_blank => true}, {:label => _("Existing medium")} %>
|
22
|
+
<% end %>
|
23
|
+
|
24
|
+
<h6><%= _("Create new installation medium") %></h6>
|
25
|
+
<%= f.fields_for :create_medium, @medium do |mf| %>
|
26
|
+
<%= text_f mf, :name, :onchange => 'setup_media_create_change(this)' %>
|
27
|
+
|
28
|
+
<%= label_tag('', :class => 'radio inline') do %>
|
29
|
+
<% radio_button_tag(:medium_type, :path, true, :onchange => 'setup_media_change(this); setup_media_create_change(this)') + _("Normal installation media") %>
|
30
|
+
<% end %>
|
31
|
+
<%= text_f mf, :path, :label => _("Path or URL") %>
|
32
|
+
|
33
|
+
<%= label_tag('', :class => 'radio inline') do %>
|
34
|
+
<% radio_button_tag(:medium_type, :spacewalk, false, :onchange => 'setup_media_change(this); setup_media_create_change(this)') + _("Red Hat Satellite 5 or Spacewalk") %>
|
35
|
+
<% end %>
|
36
|
+
<%= field(f, :spacewalk_hostname, :label => _("Hostname")) { text_field_tag :spacewalk_hostname, nil, :disabled => true } %>
|
37
|
+
<% end %>
|
38
|
+
|
39
|
+
<h4><%= _("Activation key configuration") %></h4>
|
40
|
+
<p><%= _("Users of Spacewalk, Red Hat Network, or Red Hat Satellite 5 should enter an appropriate activation key below, otherwise leave blank.") %></p>
|
41
|
+
<%= f.fields_for :satellite_type, @satellite_type do |stf| %>
|
42
|
+
<%= selectable_f stf, :value, [['Red Hat Satellite or Spacewalk', 'site'], ['Red Hat Network', 'hosted']], {:include_blank => true}, {:label => _("Type")} %>
|
43
|
+
<% end %>
|
44
|
+
<%= f.fields_for :activation_key, @activation_key do |akf| %>
|
45
|
+
<%= text_f akf, :value, :label => _("Activation key") %>
|
46
|
+
<% end %>
|
47
|
+
|
48
|
+
<%= submit_or_cancel f, false, {:cancel_path => foreman_setup_provisioners_path, :disabled => !(f.object.host.present? && f.object.smart_proxy.present?)} %>
|
49
|
+
<% end %>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
<div class="well">
|
3
|
+
<%= provisioner_wizard 5 %>
|
4
|
+
|
5
|
+
<h4><%= _("Provisioning setup complete") %></h4>
|
6
|
+
|
7
|
+
<p>
|
8
|
+
<%= _("All of the necessary components have been set up for provisioning support. You can now provision new hosts by registering them from the Hosts page, then PXE-boot the server on the subnet set up earlier.") %>
|
9
|
+
</p>
|
10
|
+
|
11
|
+
<p>
|
12
|
+
<%= _("The configuration set up is all accessible under the More menu, e.g. More > Provisioning > Subnets, and can be changed in the web interface. You can return to this set up process through <b>More > Provisioning > Provisioning Setup</b> to change settings or add new provisioning capabilities.").html_safe %>
|
13
|
+
</p>
|
14
|
+
|
15
|
+
<h4><%= _("Next steps") %></h4>
|
16
|
+
|
17
|
+
<%= option_button _("New Host"), new_host_path, :class => 'btn btn-success', :help_inline => _("Create and provision a new host") %>
|
18
|
+
<%= option_button _("Compute Resources"), compute_resources_path, :class => 'btn', :help_inline => _("Add and manage compute resources (virtualization and cloud)") %>
|
19
|
+
<%= option_button _("Edit Host Group"), edit_hostgroup_path(@provisioner.hostgroup), :class => 'btn', :help_inline => _("Review and edit the host group set up by the provisioning wizard") %>
|
20
|
+
<%= option_button _("Provisioning Setup"), foreman_setup_provisioners_path, :class => 'btn', :help_inline => _("Return to the main provisioning setup page") %>
|
21
|
+
|
22
|
+
</div>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<% title _("Provisioning setup") %>
|
2
|
+
|
3
|
+
<% title_actions display_link_if_authorized(_("Set up provisioning"), hash_for_new_foreman_setup_provisioner_path), help_path %>
|
4
|
+
|
5
|
+
<table class="table table-bordered table-striped">
|
6
|
+
<tr>
|
7
|
+
<th><%= sort :name, :as => _("Provisioning host") %></th>
|
8
|
+
<th><%= _("Smart proxy") %></th>
|
9
|
+
<th><%= _("Subnet") %></th>
|
10
|
+
<th></th>
|
11
|
+
</tr>
|
12
|
+
<% for prov in @provisioners %>
|
13
|
+
<tr>
|
14
|
+
<td><%= link_to_if_authorized h(prov.host.to_s), hash_for_edit_foreman_setup_provisioner_path(prov)%></td>
|
15
|
+
<td><%= prov.smart_proxy.try(:name) %></td>
|
16
|
+
<td><%= "#{prov.subnet.name} (#{prov.subnet.to_label})" if prov.subnet.present? %></td>
|
17
|
+
<td><%= display_delete_if_authorized hash_for_foreman_setup_provisioner_path(prov), :confirm => _("Delete %s?") % prov.host.to_s %></td>
|
18
|
+
</tr>
|
19
|
+
<% end %>
|
20
|
+
</table>
|
21
|
+
|
22
|
+
<%= page_entries_info @provisioners %>
|
23
|
+
<%= will_paginate @provisioners %>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
Rails.application.routes.draw do
|
2
|
+
namespace :foreman_setup do
|
3
|
+
resources :provisioners, :except => [:edit, :update] do
|
4
|
+
member do
|
5
|
+
get 'edit', :to => :step2
|
6
|
+
get 'step2'
|
7
|
+
put 'step2_update'
|
8
|
+
get 'step3'
|
9
|
+
post 'step4'
|
10
|
+
put 'step4_update'
|
11
|
+
get 'step5'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'foreman_setup'
|
2
|
+
require 'deface'
|
3
|
+
|
4
|
+
module ForemanSetup
|
5
|
+
class Engine < ::Rails::Engine
|
6
|
+
engine_name ForemanSetup::ENGINE_NAME
|
7
|
+
|
8
|
+
config.autoload_paths += Dir["#{config.root}/app/controllers/concerns"]
|
9
|
+
config.autoload_paths += Dir["#{config.root}/app/helpers/concerns"]
|
10
|
+
config.autoload_paths += Dir["#{config.root}/app/models/concerns"]
|
11
|
+
|
12
|
+
initializer "foreman_setup.load_app_instance_data" do |app|
|
13
|
+
app.config.paths['db/migrate'] += ForemanSetup::Engine.paths['db/migrate'].existent
|
14
|
+
end
|
15
|
+
|
16
|
+
config.to_prepare do
|
17
|
+
begin
|
18
|
+
::HomeHelper.send :include, ForemanSetup::HomeHelperExt
|
19
|
+
rescue => e
|
20
|
+
puts "#{ForemanSetup::ENGINE_NAME}: skipping engine hook (#{e.to_s})"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def table_name_prefix
|
26
|
+
ForemanSetup::ENGINE_NAME + '_'
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.table_name_prefix
|
30
|
+
ForemanSetup::ENGINE_NAME + '_'
|
31
|
+
end
|
32
|
+
|
33
|
+
def use_relative_model_naming
|
34
|
+
true
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: foreman_setup
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dominic Cleal
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-10-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: deface
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - <
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - <
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
description: Plugin for Foreman that helps set up provisioning.
|
28
|
+
email: dcleal@redhat.com
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files:
|
32
|
+
- CHANGES.md
|
33
|
+
- LICENSE
|
34
|
+
- README.md
|
35
|
+
files:
|
36
|
+
- CHANGES.md
|
37
|
+
- LICENSE
|
38
|
+
- README.md
|
39
|
+
- app/assets/javascripts/foreman_setup/provisioner.js
|
40
|
+
- app/controllers/foreman_setup/provisioners_controller.rb
|
41
|
+
- app/helpers/concerns/foreman_setup/home_helper_ext.rb
|
42
|
+
- app/helpers/foreman_setup/provisioner_helper.rb
|
43
|
+
- app/models/foreman_setup/provisioner.rb
|
44
|
+
- app/overrides/add_dashboard_provisioners_link.rb
|
45
|
+
- app/overrides/remove_subnet_domains.rb
|
46
|
+
- app/overrides/remove_subnet_proxies.rb
|
47
|
+
- app/views/foreman_setup/provisioners/_step1.html.erb
|
48
|
+
- app/views/foreman_setup/provisioners/_step2.html.erb
|
49
|
+
- app/views/foreman_setup/provisioners/_step3.html.erb
|
50
|
+
- app/views/foreman_setup/provisioners/_step4.html.erb
|
51
|
+
- app/views/foreman_setup/provisioners/_step5.html.erb
|
52
|
+
- app/views/foreman_setup/provisioners/index.html.erb
|
53
|
+
- app/views/foreman_setup/provisioners/new.html.erb
|
54
|
+
- app/views/foreman_setup/provisioners/step2.html.erb
|
55
|
+
- app/views/foreman_setup/provisioners/step3.html.erb
|
56
|
+
- app/views/foreman_setup/provisioners/step4.html.erb
|
57
|
+
- app/views/foreman_setup/provisioners/step5.html.erb
|
58
|
+
- config/routes.rb
|
59
|
+
- db/migrate/20131023140100_add_provisioners.rb
|
60
|
+
- db/migrate/20131025180600_add_provisioners_hostgroup.rb
|
61
|
+
- db/migrate/20131028161000_add_provisioners_domain.rb
|
62
|
+
- lib/foreman_setup.rb
|
63
|
+
- lib/foreman_setup/engine.rb
|
64
|
+
- lib/foreman_setup/version.rb
|
65
|
+
homepage: http://github.com/theforeman/foreman_setup
|
66
|
+
licenses:
|
67
|
+
- GPL-3
|
68
|
+
metadata: {}
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options: []
|
71
|
+
require_paths:
|
72
|
+
- lib
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
requirements: []
|
84
|
+
rubyforge_project:
|
85
|
+
rubygems_version: 2.0.8
|
86
|
+
signing_key:
|
87
|
+
specification_version: 4
|
88
|
+
summary: Helps set up Foreman for provisioning
|
89
|
+
test_files: []
|