Deploy improvement:
* fix bugs; * add deploy example; * remove duplicated params.
This commit is contained in:
parent
21c2c4620e
commit
3b34c03925
|
@ -0,0 +1,107 @@
|
|||
# Nodes
|
||||
nodes:
|
||||
- name: controller-5
|
||||
role: controller
|
||||
interfaces:
|
||||
- name: eth2
|
||||
ip_address: 10.20.0.187
|
||||
netmask: 255.255.255.0
|
||||
static: '0'
|
||||
mac_address: '08:00:27:31:09:34'
|
||||
onboot: 'no'
|
||||
peerdns: 'no'
|
||||
- name: eth1
|
||||
ip_address: 10.20.0.186
|
||||
netmask: 255.255.255.0
|
||||
static: '0'
|
||||
mac_address: 08:00:27:93:54:B0
|
||||
onboot: 'no'
|
||||
peerdns: 'no'
|
||||
- name: eth0
|
||||
#ip_address: 10.20.0.49 # ip, power_address
|
||||
#netmask: 255.255.255.0
|
||||
dns_name: controller-5.domain.tld # fqdn
|
||||
static: '0'
|
||||
mac_address: 08:00:27:53:0B:6C # mac
|
||||
onboot: 'yes'
|
||||
peerdns: 'no'
|
||||
use_for_provision: true
|
||||
#End data for provision
|
||||
default_gateway: 10.20.0.1
|
||||
network_data:
|
||||
- name: public
|
||||
ip: 172.18.94.41
|
||||
dev: eth0
|
||||
netmask: 255.255.255.0
|
||||
gateway: 172.18.94.33
|
||||
- name:
|
||||
- management
|
||||
- storage
|
||||
ip: 10.20.0.45
|
||||
dev: eth0
|
||||
netmask: 255.255.255.0
|
||||
|
||||
attributes:
|
||||
master_ip: 10.20.0.2
|
||||
use_cow_images: true
|
||||
libvirt_type: kvm
|
||||
dns_nameservers:
|
||||
- 10.20.0.2
|
||||
verbose: true
|
||||
debug: true
|
||||
auto_assign_floating_ip: true
|
||||
start_guests_on_host_boot: true
|
||||
create_networks: true
|
||||
compute_scheduler_driver: nova.scheduler.multi.MultiScheduler
|
||||
quantum: true
|
||||
management_vip: 10.20.1.200
|
||||
public_vip: 10.20.0.200
|
||||
quantum_parameters:
|
||||
tenant_network_type: gre
|
||||
segment_range: 300:500
|
||||
metadata_proxy_shared_secret: quantum
|
||||
mysql:
|
||||
root_password: root
|
||||
glance:
|
||||
db_password: glance
|
||||
user_password: glance
|
||||
swift:
|
||||
user_password: swift_pass
|
||||
nova:
|
||||
db_password: nova
|
||||
user_password: nova
|
||||
access:
|
||||
password: admin
|
||||
user: admin
|
||||
tenant: admin
|
||||
email: admin@example.org
|
||||
keystone:
|
||||
db_password: keystone
|
||||
admin_token: nova
|
||||
quantum_access:
|
||||
user_password: quantum
|
||||
db_password: quantum
|
||||
rabbit:
|
||||
password: nova
|
||||
user: nova
|
||||
cinder:
|
||||
password: cinder
|
||||
user: cinder
|
||||
floating_network_range: 10.20.0.150/28
|
||||
fixed_network_range: 10.20.1.0/24
|
||||
base_syslog:
|
||||
syslog_port: '514'
|
||||
syslog_server: 10.20.0.2
|
||||
syslog:
|
||||
syslog_port: '514'
|
||||
syslog_transport: udp
|
||||
syslog_server: ''
|
||||
use_unicast_corosync: false
|
||||
horizon_use_ssl: 'false'
|
||||
cinder_nodes:
|
||||
- controller
|
||||
ntp_servers:
|
||||
- pool.ntp.org
|
||||
deployment_id: 1
|
||||
deployment_mode: multinode
|
||||
deployment_source: cli
|
|
@ -19,6 +19,9 @@ mapping:
|
|||
"fqdn":
|
||||
type: text
|
||||
desc: Fully-qualified domain name of the node
|
||||
"default_gateway":
|
||||
type: text
|
||||
desc: Default gateway for network_data
|
||||
"role":
|
||||
type: text
|
||||
required: true
|
||||
|
@ -38,9 +41,9 @@ mapping:
|
|||
- type: map
|
||||
mapping:
|
||||
"name":
|
||||
type: text
|
||||
unique: true
|
||||
enum: ['management', 'public', 'storage', 'fixed']
|
||||
type: any
|
||||
#unique: true
|
||||
#enum: ['management', 'public', 'storage', 'fixed']
|
||||
desc: Network type
|
||||
"dev":
|
||||
type: text
|
||||
|
@ -113,6 +116,10 @@ mapping:
|
|||
"start_guests_on_host_boot":
|
||||
type: bool
|
||||
required: true
|
||||
"create_networks":
|
||||
type: bool
|
||||
required: true
|
||||
desc: Whether to create fixed or floating networks
|
||||
"quantum":
|
||||
type: bool
|
||||
required: true
|
||||
|
@ -275,6 +282,10 @@ mapping:
|
|||
type: text
|
||||
enum: ['false', 'default', 'exist', 'custom']
|
||||
desc: Use HTTP or HTTPS for OpenStack dashboard (Horizon)
|
||||
"compute_scheduler_driver":
|
||||
type: text
|
||||
enum: ['nova.scheduler.multi.MultiScheduler']
|
||||
desc: Nova scheduler driver class
|
||||
"use_unicast_corosync":
|
||||
type: bool
|
||||
default: false
|
||||
|
@ -293,4 +304,4 @@ mapping:
|
|||
"debug":
|
||||
type: bool
|
||||
desc: How much information OpenStack provides when performing configuration (debug mode)
|
||||
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ module Astute
|
|||
def initialize(file, operation)
|
||||
@config = YAML.load_file(file)
|
||||
validate_enviroment(operation)
|
||||
to_full_config
|
||||
to_full_config(operation)
|
||||
end
|
||||
|
||||
def [](key)
|
||||
|
@ -44,19 +44,30 @@ module Astute
|
|||
|
||||
private
|
||||
|
||||
def to_full_config
|
||||
# Provision section
|
||||
def to_full_config(operation)
|
||||
@config['nodes'].each do |node|
|
||||
|
||||
# Common section
|
||||
node['meta'] ||= {}
|
||||
define_provisioning_network(node)
|
||||
define_id_and_uid(node)
|
||||
define_interfaces_and_interfaces_extra(node)
|
||||
define_ks_spaces(node)
|
||||
define_power_info(node)
|
||||
define_ks_meta(node)
|
||||
define_node_settings(node)
|
||||
define_disks_section(node)
|
||||
|
||||
# Provision section
|
||||
if [:provision, :provision_and_deploy].include? operation
|
||||
define_interfaces_and_interfaces_extra(node)
|
||||
define_ks_spaces(node)
|
||||
define_power_info(node)
|
||||
define_ks_meta(node)
|
||||
define_node_settings(node)
|
||||
define_disks_section(node)
|
||||
end
|
||||
|
||||
# Deploy section
|
||||
if [:deploy, :provision_and_deploy].include? operation
|
||||
define_meta_interfaces(node)
|
||||
define_fqdn(node)
|
||||
end
|
||||
end
|
||||
# Deploy section
|
||||
end
|
||||
|
||||
|
||||
|
@ -80,9 +91,11 @@ module Astute
|
|||
response = RestClient.get 'http://localhost:8000/api/nodes'
|
||||
@api_data = JSON.parse(response).freeze
|
||||
end
|
||||
@api_data.find{ |n| n['mac'].upcase == node['mac'].upcase }
|
||||
return @api_data if @api_data
|
||||
raise Enviroment::ValidationError, "Node #{node['name']} with mac adress #{node['mac']}
|
||||
if node['mac']
|
||||
node = @api_data.find{ |n| n['mac'].upcase == node['mac'].upcase }
|
||||
return node if node
|
||||
end
|
||||
raise Enviroment::ValidationError, "Node #{node['name']} with mac address #{node['mac']}
|
||||
not find among discovered nodes"
|
||||
end
|
||||
|
||||
|
@ -110,7 +123,6 @@ module Astute
|
|||
# }...
|
||||
# ]
|
||||
def define_disks_section(node)
|
||||
node['meta'] ||= {}
|
||||
node['meta']['disks'] = find_node_api_data(node)['meta']['disks']
|
||||
end
|
||||
|
||||
|
@ -152,8 +164,10 @@ module Astute
|
|||
|
||||
if provision_eth
|
||||
if provision_eth.absent?('ip_address')
|
||||
node['mac'] = provision_eth['mac_address']
|
||||
api_node = find_node_api_data(node)
|
||||
api_provision_eth = api_node['meta']['interfaces'].find { |n| n['mac'].upcase == provision_eth['mac_address'].upcase }
|
||||
|
||||
api_provision_eth = api_node['meta']['interfaces'].find { |n| n['mac'].to_s.upcase == provision_eth['mac_address'].to_s.upcase }
|
||||
provision_eth['ip_address'] = api_provision_eth['ip']
|
||||
provision_eth['netmask'] = api_provision_eth['netmask']
|
||||
end
|
||||
|
@ -196,6 +210,7 @@ module Astute
|
|||
interfaces_extra_interfaces = {}
|
||||
node['interfaces'].each do |eth|
|
||||
formated_interfaces[eth['name']] = eth
|
||||
formated_interfaces[eth['name']].delete('name')
|
||||
interfaces_extra_interfaces[eth['name']] = {
|
||||
'onboot' => eth['onboot'],
|
||||
'peerdns' => eth['onboot']
|
||||
|
@ -204,6 +219,24 @@ module Astute
|
|||
node['interfaces'] = formated_interfaces
|
||||
node['extra_interfaces'] = interfaces_extra_interfaces
|
||||
end
|
||||
|
||||
# Add duplicate param 'fqdn' to node if it is not specified
|
||||
def define_fqdn(node)
|
||||
node['fqdn'] ||= find_node_api_data(node)['meta']['system']['fqdn']
|
||||
end
|
||||
|
||||
# Add meta/interfaces section for node:
|
||||
# meta:
|
||||
# interfaces:
|
||||
# - name: eth0
|
||||
# ip: 10.20.0.95
|
||||
# netmask: 255.255.255.0
|
||||
# mac: 08:00:27:C2:06:DE
|
||||
# max_speed: 100
|
||||
# current_speed: 100
|
||||
def define_meta_interfaces(node)
|
||||
node['meta']['interfaces'] = find_node_api_data(node)['meta']['interfaces']
|
||||
end
|
||||
|
||||
# Generate 'ks_spaces' param from 'ks_disks' param in section 'ks_meta'
|
||||
# Example input for 'ks_disks' param:
|
||||
|
@ -243,4 +276,4 @@ module Astute
|
|||
class Enviroment::ValidationError < StandardError; end
|
||||
|
||||
end # module Cli
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue