ajout liens edition
parent
69488086da
commit
b5c594aac0
|
|
@ -9,12 +9,13 @@ services:
|
||||||
- "traefik.docker.network=traefik"
|
- "traefik.docker.network=traefik"
|
||||||
- "traefik.http.routers.autoinstall.entrypoints=websecure"
|
- "traefik.http.routers.autoinstall.entrypoints=websecure"
|
||||||
- "traefik.http.routers.autoinstall.tls=true"
|
- "traefik.http.routers.autoinstall.tls=true"
|
||||||
- "traefik.http.routers.autoinstall.rule=Host(`zenisntall.install.lan`)"
|
- "traefik.http.routers.autoinstall.rule=Host(`zeninstall.zen6.info`)"
|
||||||
- "traefik.http.services.autoinstall.loadbalancer.server.port=3000"
|
- "traefik.http.services.autoinstall.loadbalancer.server.port=3000"
|
||||||
|
- "traefik.http.routers.autoinstall.tls.certresolver=le"
|
||||||
stdin_open: true
|
stdin_open: true
|
||||||
tty: true
|
tty: true
|
||||||
ports:
|
# ports:
|
||||||
- 4000:3000
|
# - 4000:3000
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
- traefik
|
- traefik
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ class EngineController < ApplicationController
|
||||||
if @host.toinstall
|
if @host.toinstall
|
||||||
@host.update({status: "Computer Booting"})
|
@host.update({status: "Computer Booting"})
|
||||||
end
|
end
|
||||||
|
@api_uri = get_uri(@site)
|
||||||
result = render inline: boot_script, layout: false, content_type: 'text/plain'
|
result = render inline: boot_script, layout: false, content_type: 'text/plain'
|
||||||
@host.update({lastbootgenerated: result})
|
@host.update({lastbootgenerated: result})
|
||||||
end
|
end
|
||||||
|
|
@ -37,6 +38,7 @@ class EngineController < ApplicationController
|
||||||
@template = @host.installtemplate
|
@template = @host.installtemplate
|
||||||
host = @host
|
host = @host
|
||||||
@host.update({status: "System Install"})
|
@host.update({status: "System Install"})
|
||||||
|
@api_uri = get_uri(@site)
|
||||||
result = render inline: script, layout: false, content_type: 'text/plain'
|
result = render inline: script, layout: false, content_type: 'text/plain'
|
||||||
@host.update({lastinstallgenerated: result})
|
@host.update({lastinstallgenerated: result})
|
||||||
else
|
else
|
||||||
|
|
@ -57,6 +59,7 @@ class EngineController < ApplicationController
|
||||||
@site = @host.site
|
@site = @host.site
|
||||||
host = @host
|
host = @host
|
||||||
@template = @host.installtemplate
|
@template = @host.installtemplate
|
||||||
|
@api_uri = get_uri(@site)
|
||||||
result = render inline: script, layout: false, content_type: 'text/plain'
|
result = render inline: script, layout: false, content_type: 'text/plain'
|
||||||
@host.update({lastpostinstallgenerated: result})
|
@host.update({lastpostinstallgenerated: result})
|
||||||
end
|
end
|
||||||
|
|
@ -100,6 +103,7 @@ class EngineController < ApplicationController
|
||||||
@site = @host.site
|
@site = @host.site
|
||||||
@template = @host.installtemplate
|
@template = @host.installtemplate
|
||||||
host = @host
|
host = @host
|
||||||
|
@api_uri = get_uri(@site)
|
||||||
result = render inline: script.content, layout: false, content_type: 'text/plain'
|
result = render inline: script.content, layout: false, content_type: 'text/plain'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -118,13 +122,19 @@ class EngineController < ApplicationController
|
||||||
# Generate random lusk key
|
# Generate random lusk key
|
||||||
random_string=SecureRandom.urlsafe_base64(24)
|
random_string=SecureRandom.urlsafe_base64(24)
|
||||||
# Create new host
|
# Create new host
|
||||||
@host = Host.new(hostname: "New host detected",uuid: params["uuid"], install_ip: params["ip"], installtemplate: @template,site: @site, mac: params["mac"], status: "discover", discover: true,installed: false, toinstall: false,rootaccount: @account, mainaccount: @account, product: params["product"], serial: params["serial"], lusk_key: random_string)
|
@host = Host.new(hostname: "New host detected",uuid: params["uuid"], install_ip: params["ip"], installtemplate: @template,site: @site, mac: params["mac"], status: "discover", discover: true,installed: false, toinstall: false,rootaccount: @account, mainaccount: @account, product: params["p"], serial: params["s"], lusk_key: random_string)
|
||||||
@host.save!
|
@host.save!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# Only allow a list of trusted parameters through.
|
# Only allow a list of trusted parameters through.
|
||||||
def host_params
|
def host_params
|
||||||
params.require(:host).permit(:uuid, :hostname, :ip, :status, :mac, :discover, :installed, :interface , :installtemplate, :site , :installtemplate_id, :site_id, :rootaccount_id, :mainaccount_id,:toinstall, :install_ip, :filename, :access_ip, :product, :serial)
|
params.require(:host).permit(:uuid, :hostname, :ip, :status, :mac, :discover, :installed, :interface , :installtemplate, :site , :installtemplate_id, :site_id, :rootaccount_id, :mainaccount_id,:toinstall, :install_ip, :filename, :access_ip, :product, :serial,:p,:s)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
def get_uri(site)
|
||||||
|
if site.api_url.empty?
|
||||||
|
return "http://#{site.api_ip}:#{site.api_port}"
|
||||||
|
else
|
||||||
|
return site.api_url
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,7 @@ class HostsController < ApplicationController
|
||||||
@site = @host.site
|
@site = @host.site
|
||||||
host = @host
|
host = @host
|
||||||
@template = @host.installtemplate
|
@template = @host.installtemplate
|
||||||
|
@api_uri = get_uri(@site)
|
||||||
result = render inline: boot_script, layout: false, content_type: 'text/plain'
|
result = render inline: boot_script, layout: false, content_type: 'text/plain'
|
||||||
@host.update({lastbootgenerated: result})
|
@host.update({lastbootgenerated: result})
|
||||||
|
|
||||||
|
|
@ -85,6 +86,7 @@ class HostsController < ApplicationController
|
||||||
@site = @host.site
|
@site = @host.site
|
||||||
host = @host
|
host = @host
|
||||||
@template = @host.installtemplate
|
@template = @host.installtemplate
|
||||||
|
@api_uri = get_uri(@site)
|
||||||
result = render inline: script, layout: false, content_type: 'text/plain'
|
result = render inline: script, layout: false, content_type: 'text/plain'
|
||||||
@host.update({lastinstallgenerated: result})
|
@host.update({lastinstallgenerated: result})
|
||||||
end
|
end
|
||||||
|
|
@ -97,6 +99,7 @@ class HostsController < ApplicationController
|
||||||
@ansible = Account.find_by(name: "ansible")
|
@ansible = Account.find_by(name: "ansible")
|
||||||
@site = @host.site
|
@site = @host.site
|
||||||
host = @host
|
host = @host
|
||||||
|
@api_uri = get_uri(@site)
|
||||||
@template = @host.installtemplate
|
@template = @host.installtemplate
|
||||||
result = render inline: script, layout: false, content_type: 'text/plain'
|
result = render inline: script, layout: false, content_type: 'text/plain'
|
||||||
end
|
end
|
||||||
|
|
@ -112,6 +115,14 @@ class HostsController < ApplicationController
|
||||||
private
|
private
|
||||||
# Use callbacks to share common setup or constraints between actions.
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
|
|
||||||
|
def get_uri(site)
|
||||||
|
if site.api_url.empty?
|
||||||
|
return "http://#{site.api_ip}:#{site.api_port}"
|
||||||
|
else
|
||||||
|
return site.api_url
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def set_host
|
def set_host
|
||||||
logger.debug "#{params}"
|
logger.debug "#{params}"
|
||||||
@host = Host.find(params[:id])
|
@host = Host.find(params[:id])
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ class SitesController < ApplicationController
|
||||||
|
|
||||||
# Only allow a list of trusted parameters through.
|
# Only allow a list of trusted parameters through.
|
||||||
def site_params
|
def site_params
|
||||||
params.require(:site).permit(:name, :domain, :gateway, :nameserver, :network, :netmask, :server_ip, :server_port, :fileserver_ip, :fileserver_port,:fileserver_basepath, :timezone, :apiurl, :cfenginehub, :nfsserver_path, :country)
|
params.require(:site).permit(:name, :domain, :gateway, :nameserver, :network, :netmask, :api_ip, :api_port, :api_url, :fileserver_uri, :fileserver_basepath, :timezone, :apiurl, :cfenginehub, :nfsserver_path, :country)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,17 +7,19 @@ class Site
|
||||||
field :nameserver, type: String
|
field :nameserver, type: String
|
||||||
field :network, type: String
|
field :network, type: String
|
||||||
field :netmask, type: String
|
field :netmask, type: String
|
||||||
field :server_ip, type: String
|
field :api_ip, type: String
|
||||||
field :server_port, type: String
|
field :api_port, type: String
|
||||||
field :fileserver_ip, type: String
|
field :api_url, type: String
|
||||||
field :fileserver_port, type: String
|
field :fileserver_uri, type: String
|
||||||
field :fileserver_basepath, type: String
|
field :fileserver_basepath, type: String
|
||||||
|
field :fileserver_url, type: String
|
||||||
|
field :nfsserver_ip, type: String
|
||||||
field :nfsserver_path, type: String
|
field :nfsserver_path, type: String
|
||||||
field :country, type: String
|
field :country, type: String
|
||||||
field :timezone, type: String
|
field :timezone, type: String
|
||||||
field :apiurl, type: String
|
|
||||||
field :description, type: String
|
field :description, type: String
|
||||||
field :cfenginehub, type: String
|
field :cfenginehub, type: String , default: ''
|
||||||
has_many :sitereferences, class_name: "Host", inverse_of: :site
|
has_many :sitereferences, class_name: "Host", inverse_of: :site
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -238,3 +238,5 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<%= button_to "Edit Template", "/installtemplates/#{@host.installtemplate_id}/edit", method: :get, class: "button is-small is-primary", form: {target: '_blank'}%></tr>
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@
|
||||||
<%= form.text_field :kernel , { class: "input"} %>
|
<%= form.text_field :kernel , { class: "input"} %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<%= form.label :initrd, class: "label" %>
|
<%= form.label :initrd, class: "label" %>
|
||||||
<div class="control">
|
<div class="control">
|
||||||
|
|
@ -95,17 +95,24 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<%= form.label :lang, class: "label" %>
|
<%= form.label :lang, class: "label" %>
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<%= form.text_field :lang , { class: "input"} %>
|
<%= form.text_field :lang , { class: "input"} %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<button class="button is-link">Submit</button>
|
<button class="button is-link">Submit</button>
|
||||||
<%= link_to "Return", "/installtemplates", class: "button is-success" %>
|
<%= link_to "Return", "/installtemplates", class: "button is-success" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<section class="section">
|
||||||
|
<div class="columns">
|
||||||
|
<%= button_to "Edit Boot", "/scripts/#{@installtemplate.boot_id}/edit", method: :get, class: "button is-small is-primary" , form: {target: '_blank'}%>
|
||||||
|
<%= button_to "Edit Install", "/scripts/#{@installtemplate.install_id}/edit", method: :get, class: "button is-small is-primary", form: {target: '_blank'} %>
|
||||||
|
<%= button_to "Edit Post Install", "/scripts/#{@installtemplate.postinstall_id}/edit", method: :get, class: "button is-small is-primary", form: {target: '_blank'} %>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
|
||||||
|
|
@ -43,9 +43,9 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<%= form.label :apiurl, class: "label" %>
|
<%= form.label :api_url, class: "label" %>
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<%= form.text_field :apiurl , { class: "input"} %>
|
<%= form.text_field :api_url , { class: "input"} %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -59,37 +59,37 @@
|
||||||
|
|
||||||
<div class="field is-grouped">
|
<div class="field is-grouped">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="label">Serveur IP</label>
|
<label class="label">api_ip</label>
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<%= form.text_field :server_ip , { class: "input"} %>
|
<%= form.text_field :api_ip , { class: "input"} %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="label">Serveur Port</label>
|
<label class="label">api_port</label>
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<%= form.text_field :server_port , { class: "input"} %>
|
<%= form.text_field :api_port , { class: "input"} %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label class="label">api_url</label>
|
||||||
|
<div class="control">
|
||||||
|
<%= form.text_field :api_url , { class: "input"} %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="field is-grouped">
|
<div class="field is-grouped">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="label">File Server Ip</label>
|
<label class="label">fileserver_uri</label>
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<%= form.text_field :fileserver_ip , { class: "input"} %>
|
<%= form.text_field :fileserver_uri , { class: "input"} %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="field">
|
|
||||||
<label class="label">File Server Port</label>
|
|
||||||
<div class="control">
|
|
||||||
<%= form.text_field :fileserver_port , { class: "input"} %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="label">File Server Basepath</label>
|
<label class="label">fileserver_basepath</label>
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<%= form.text_field :fileserver_basepath , { class: "input"} %>
|
<%= form.text_field :fileserver_basepath , { class: "input"} %>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -102,9 +102,8 @@
|
||||||
<%= form.text_field :cfenginehub , { class: "input"} %>
|
<%= form.text_field :cfenginehub , { class: "input"} %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% if not @site.cfenginehub.empty? -%>
|
<%= link_to "Goto cfengine hub", "http://#{@site.cfenginehub}", class: "button is-info", :target => "_blank" %>
|
||||||
<%= link_to "Goto cfengine hub", "http://#{@site.cfenginehub}", class: "button is-info", :target => "_blank" %>
|
|
||||||
<% end -%>
|
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<%= form.label :country, class: "label" %>
|
<%= form.label :country, class: "label" %>
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<strong>Server:</strong>
|
<strong>Server:</strong>
|
||||||
<%= site.server_ip %>:<%= site.server_port %>:
|
<%= site.api_ip %>:<%= site.api_ip %>:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,6 @@ module Autogen
|
||||||
#
|
#
|
||||||
# config.time_zone = "Central Time (US & Canada)"
|
# config.time_zone = "Central Time (US & Canada)"
|
||||||
# config.eager_load_paths << Rails.root.join("extras")
|
# config.eager_load_paths << Rails.root.join("extras")
|
||||||
config.hosts << "zeninstall.install.lan"
|
config.hosts << "zeninstall.zen6.info"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ development:
|
||||||
# Defines the default client. (required)
|
# Defines the default client. (required)
|
||||||
default:
|
default:
|
||||||
# Mongoid can connect to a URI accepted by the driver:
|
# Mongoid can connect to a URI accepted by the driver:
|
||||||
uri: mongodb://railszen:railszen@mongo:27017/railszen
|
uri: mongodb://zeninstall:pTcwn5FSHWQaedVhxzLZ8g@mongo:27017/railszen
|
||||||
# Otherwise define the parameters separately.
|
# Otherwise define the parameters separately.
|
||||||
# This defines the name of the default database that Mongoid can connect to.
|
# This defines the name of the default database that Mongoid can connect to.
|
||||||
# (required).
|
# (required).
|
||||||
|
|
@ -175,11 +175,11 @@ development:
|
||||||
test:
|
test:
|
||||||
clients:
|
clients:
|
||||||
default:
|
default:
|
||||||
uri: mongodb://railszen:railszen@mongo:27017/railszen
|
uri: mongodb://zeninstall:pTcwn5FSHWQaedVhxzLZ8g @mongo:27017/railszen
|
||||||
# database: autodeploy_test
|
# database: autodeploy_test
|
||||||
# hosts:
|
# hosts:
|
||||||
# - localhost:27017
|
# - localhost:27017
|
||||||
options:
|
options:
|
||||||
read:
|
read:
|
||||||
mode: :primary
|
mode: :primary
|
||||||
max_pool_size: 1
|
max_pool_size: 1
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue