Commit 42ad3406 authored by Hyacinthe Cartiaux's avatar Hyacinthe Cartiaux
Browse files
parents 55a2ad22 76434129
#!/usr/bin/env ruby
# Author:: Pascal Morillon (<pascal.morillon@irisa.fr>)
# Date:: Thu Dec 08 15:48:23 +0100 2011
#
require 'yaml'
site = 'rennes'
clusters = %w{paramount paradent parapide parapluie}
primary_eth = {
"paramount" => "eth0",
"paradent" => "eth0",
"parapide" => "eth0",
"parapluie" => "eth1"
}
not_referenced = []
conf = ""
clusters.each do |cluster|
yamldoc = YAML.load(File.read(File.join("generators", "input", "#{site}-#{cluster}.yaml")))
nodes = yamldoc.sort { |a,b| a.first.split('-')[1].to_i <=> b.first.split('-')[1].to_i }
nodes.each do |node|
if node.last["network_interfaces"][primary_eth[cluster]]["switch_port"].nil?
not_referenced << node.first
next
end
conf += "!\n"
conf += "interface GigabitEthernet#{node.last["network_interfaces"][primary_eth[cluster]]["switch_port"].split('i').last}\n"
conf += " description #{node.first}\n"
conf += " switchport access vlan 100\n"
end
end
conf += "!\n"
puts conf
if not_referenced.length > 0
STDERR.puts "Not referenced nodes :"
STDERR.puts not_referenced.inspect
end
#!/usr/bin/env ruby
# Author:: Pascal Morillon (<pascal.morillon@irisa.fr>)
# Date:: Thu Dec 08 13:47:03 +0100 2011
#
require 'yaml'
site = 'rennes'
clusters = %w{paramount paradent parapide parapluie}
primary_eth = {
"paramount" => "eth0",
"paradent" => "eth0",
"parapide" => "eth0",
"parapluie" => "eth1"
}
clusters.each do |cluster|
conf = ""
yamldoc = YAML.load(File.read(File.join("generators", "input", "#{site}-#{cluster}.yaml")))
nodes = yamldoc.sort { |a,b| a.first.split('-')[1].to_i <=> b.first.split('-')[1].to_i }
conf += "# Cluster #{cluster} - production network vlan100\n"
conf += "group {\n"
conf += "\n"
nodes.each do |node|
conf += " host #{node.first} {\n"
conf += " hardware ethernet #{node.last["network_interfaces"][primary_eth[cluster]]["mac"]};\n"
conf += " fixed-address #{node.last["network_interfaces"][primary_eth[cluster]]["ip"]};\n"
conf += " }\n"
conf += "\n"
end
conf += "}\n"
conf += "\n"
conf += "\n"
conf += "# Cluster #{cluster} - management network vlan101\n"
conf += "group {\n"
conf += "\n"
nodes.each do |node|
conf += " host #{node.first}-bmc {\n"
conf += " hardware ethernet #{node.last["network_interfaces"]["bmc"]["mac"]};\n"
conf += " fixed-address #{node.last["network_interfaces"]["bmc"]["ip"]};\n"
conf += " }\n"
conf += "\n"
end
conf += "}\n"
conf += "\n"
conf += "\n"
puts conf
end
#!/usr/bin/env ruby
# Author:: Pascal Morillon (<pascal.morillon@irisa.fr>)
# Date:: Wed Dec 07 14:14:02 +0100 2011
#
require 'yaml'
$cluster = "parapluie"
case $cluster
when "paramount"
$site = "rennes"
$default_eth = "eth0"
$hp_net = "myri0"
$ip_prefix = "172.16.96"
$nb_nodes = 33
when "paradent"
$site = "rennes"
$default_eth = "eth0"
$hp_net = false
$ip_prefix = "172.16.97"
$nb_nodes = 64
when "parapide"
$site = "rennes"
$default_eth = "eth0"
$hp_net = "ib0"
$ip_prefix = "172.16.98"
$nb_nodes = 25
when "parapluie"
$site = "rennes"
$default_eth = "eth1"
$hp_net = "ib0"
$ip_prefix = "172.16.99"
$nb_nodes = 40
else
raise "Cluster #{$cluster} is not yet supported ! Check script code..."
end
yamldoc = YAML.load(File.read(File.join("generators", "input", "#{$site}-#{$cluster}.yaml")))
(1..$nb_nodes).each do |index|
ip_tab = $ip_prefix.split('.')
eth_ip = (ip_tab << index.to_s).join('.')
bmc_ip = [ip_tab[0], "17", ip_tab[2], index.to_s].join('.')
hp_ip = [ip_tab[0], "18", ip_tab[2], index.to_s].join('.')
yamldoc["#{$cluster}-#{index}"]["network_interfaces"]["bmc"]["ip"] = bmc_ip
yamldoc["#{$cluster}-#{index}"]["network_interfaces"][$default_eth]["ip"] = eth_ip
yamldoc["#{$cluster}-#{index}"]["network_interfaces"][$hp_net]["ip"] = hp_ip if $hp_net
end
puts yamldoc.to_yaml
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment