add flavor support and re-organzied var_dicts

Re-organize the first level dict value in var_dict to a new searchlist
for cheetah template.

Change-Id: I584594509abc82c11302ca6db577769ab3df8db4
This commit is contained in:
grace.yu
2014-08-27 23:11:54 -07:00
committed by Weidong Shao
parent 7ea34feb85
commit 2468fc5410
25 changed files with 674 additions and 423 deletions

View File

@@ -1,22 +1,10 @@
#set aval_services = ['nova', 'horizon', 'keystone', 'glance', 'ceilometer', 'neutron', 'cinder', 'heat', 'dash']
#set config = $cluster.deployed_package_config
#set service_config = {}
#if "service_credentials" in $config:
#set service_config = $cluster.deployed_package_config.service_credentials
#end if
#set databagitems = {}
#for $service in $aval_services:
#set databagitems[$service] = {$service: $service}
#end for
#if service_config:
#for $service, $value in $service_config.iteritems():
#if $service in $aval_services:
#set databagitems[$service] = {$service: $value.password}
#end if
#end for
#end if
#import simplejson as json
#set output = json.dumps($databagitems, encoding='utf-8')
$output
{
"nova": {
"nova": "mypass"
},
"horizon": {
"horizon": "horizon"
},
"keystone": {
}
}

View File

@@ -1,8 +0,0 @@
{
"openstack_identity_bootstrap_token": {
"openstack_identity_bootstrap_token": "mytoken"
},
"neutron_metadata_secret": {
"neutron_metadata_secret": "secret"
}
}

View File

@@ -1,24 +0,0 @@
#set required_services = ['openstack-image', 'openstack-compute', 'openstack-block-storage', 'openstack-orchestration', 'openstack-network', 'rbd']
#set config = $cluster.deployed_package_config
#set services_config = {}
#if "services_credentials" in $config:
#set services_config = $cluster.deployed_package_config.services_credentials
#end if
#set databagitems = {}
#for $service in $required_services:
#if $service not in $databagitems:
#set databagitems[$service] = {$service: $service}
#end if
#end for
#if services_config:
#for $service, $value in $services_config.iteritems():
#if $service in $required_services:
#set databagitems[$service] = {$service: $value.password}
#end if
#end for
#end if
#import simplejson as json
#set output = json.dumps($databagitems, encoding='utf-8')
$output

View File

@@ -1,20 +0,0 @@
#set required_users = ['admin']
#set config = $cluster.deployed_package_config
#set user_config = {}
#if "users_credentials" in $config:
#set user_config = $cluster.deployed_package_config.users_credentials
#end if
#set databagitems = {}
#if user_config:
#for $user, $value in $user_config.iteritems():
#set databagitems[$user] = {$value.username: $value.password}
#end for
#end if
#for $user in $required_users:
#if $user not in $databagitems:
#set databagitems[$user] = {$user: $user}
#end if
#end for
#import simplejson as json
#set output = json.dumps($databagitems, encoding='utf-8')
$output

View File

@@ -1,9 +1,6 @@
#set config = $cluster.deployed_package_config
#set mappings = $config.roles_mapping
#set credentials = $config.service_credentials
#set allinone_compute_mgmt_nic = $mappings.allinone_compute.management.interface
#set allinone_compute_mgmt_ip = $mappings.allinone_compute.management.ip
#set allinone_compute_mgmt_nic = $mappings.allinone_compute.management.interface
#set credentials = $service_credentials
#set allinone_compute_mgmt_nic = $allinone_compute.management.interface
#set allinone_compute_mgmt_ip = $allinone_compute.management.ip
{
"name": "testing",
"description": "Environment used in testing the upstream cookbooks and reference Chef repository",

View File

@@ -0,0 +1,300 @@
#set controller_mgmt_ip = $os_controller.management.ip
{
"name": "testing",
"description": "Environment used in testing the upstream cookbooks and reference Chef repository",
"cookbook_versions": {
},
"json_class": "Chef::Environment",
"chef_type": "environment",
"default_attributes": {
"mysql": {
"server_root_password": "test",
"server_debian_password": "root",
"server_repl_password": "root",
"allow_remote_root": true,
"root_network_acl": "%"
},
"openstack": {
"auth": {
"validate_certs": false
},
"block-storage": {
"syslog": {
"use": false
},
"api": {
"ratelimit": "False"
},
"debug": true
},
"dashboard": {
"use_ssl": "false"
},
"compute": {
#set compute_mgmt_nic = $os_compute_worker.management.interface
"syslog": {
"use": false
},
"libvirt": {
"bind_interface": "$compute_mgmt_nic"
},
"novnc_proxy": {
"bind_interface": "$compute_mgmt_nic"
},
"xvpvnc_proxy": {
"bind_interface": "$compute_mgmt_nic"
},
"ratelimit": {
"api": {
"enabled": false
},
"volume": {
"enabled": false
}
},
"network": {
"service_type": "neutron"
}
},
"network": {
"verbose": "True",
"debug": "True",
"service_plugins": [
"router"
],
"ml2": {
"type_drivers": "gre",
"tenant_network_types": "gre",
"tunnel_id_ranges": "1:1000",
"enable_security_group": "True"
},
"openvswitch": {
"tenant_network_type": "gre",
"enable_tunneling": "True",
"tunnel_id_ranges": "1:1000"
},
"l3": {
"external_network_bridge_interface": "$os_compute_worker.public.interface"
}
},
"db": {
"bind_interface": "$os_controller.management.interface",
#set db_role = $getVar('os_ops_database', None)
#set db_mgmt_ip = $os_controller.management.ip
#if db_role is not None:
#set db_mgmt_ip = $db_role.management.ip
#end if
"compute": {
"host": "$db_mgmt_ip"
},
"identity": {
"host": "$db_mgmt_ip"
},
"image": {
"host": "$db_mgmt_ip"
},
"network": {
"host": "$db_mgmt_ip"
},
"volume": {
"host": "$db_mgmt_ip"
},
"dashboard": {
"host": "$db_mgmt_ip"
},
"telemetry": {
"host": "$db_mgmt_ip"
},
"orchestration": {
"host": "$db_mgmt_ip"
}
},
"developer_mode": true,
"endpoints": {
"db": {
"host": "$db_mgmt_ip"
},
"mq": {
#set msg_queue_ip = controller_mgmt_ip
#if $getVar('os_ops_messaging', None) is not None:
#set msg_queue_ip = $os_ops_messaging.management.ip
#end if
"host": "$msg_queue_ip"
},
"compute-api": {
"host": "$controller_mgmt_ip",
"scheme": "http",
"port": "8774",
"path": "/v2/%(tenant_id)s"
},
"compute-api-bind": {
"bind_interface": "$os_controller.management.interface"
},
"compute-ec2-admin": {
"host": "$controller_mgmt_ip",
"scheme": "http",
"port": "8773",
"path": "/services/Admin"
},
"compute-ec2-api": {
"host": "$controller_mgmt_ip",
"scheme": "http",
"port": "8773",
"path": "/services/Cloud"
},
"compute-novnc": {
"host": "$controller_mgmt_ip",
"scheme": "http",
"port": "6080",
"path": "/vnc_auto.html"
},
"compute-novnc-bind": {
"bind_interface": "$os_controller.management.interface"
},
"vnc_bind": {
"bind_interface": "$os_controller.management.interface"
},
"image-api": {
#set glance_ip = controller_mgmt_ip
#set glance_nic = $os_controller.management.interface
#if $getVar('os_image', None) is not None:
#set glance_ip = $os_image.management.ip
#set glance_nic = $os_image.management.interface
#end if
"host": "$glance_ip",
"scheme": "http",
"port": "9292",
"path": "/v2"
},
"image-api-bind": {
"bind_interface": "$glance_nic"
},
"image-registry": {
"host": "$glance_ip",
"scheme": "http",
"port": "9191",
"path": "/v2"
},
"image-registry-bind": {
"bind_interface": "$glance_nic"
},
"identity-bind": {
"bind_interface": "$os_controller.management.interface"
},
"identity-api": {
"host": "$controller_mgmt_ip",
"scheme": "http",
"port": "5000",
"path": "/v2.0"
},
"identity-admin": {
"host": "$controller_mgmt_ip",
"scheme": "http",
"port": "35357",
"path": "/v2.0"
},
"block-storage-api": {
"host": "$controller_mgmt_ip",
"scheme": "http",
"port": "8776",
"path": "/v1/%(tenant_id)s"
},
"block-storage-api-bind": {
"bind_interface": "$os_controller.management.interface"
},
"telemetry-api": {
"host": "$controller_mgmt_ip",
"scheme": "http",
"port": "8777",
"path": "/v1"
},
"network-api": {
"host": "$controller_mgmt_ip",
"scheme": "http",
"port": "9696",
"path": ""
},
"network-api-bind": {
"bind_interface": "$os_controller.management.interface"
},
"network-openvswitch": {
"bind_interface": "$os_controller.management.interface"
},
"orchestration-api": {
"host": "$controller_mgmt_ip",
"scheme": "http",
"port": "8004",
"path": "/v1/%(tenant_id)s"
},
"orchestration-api-cfn": {
"host": "$controller_mgmt_ip",
"scheme": "http",
"port": "8000",
"path": "/v1"
}
},
"identity": {
"admin_user": "admin",
"bind_interface": "$os_controller.management.interface",
"catalog": {
"backend": "sql"
},
"debug": true,
"roles": [
"admin",
"member"
],
"syslog": {
"use": false
},
"tenants": [
"admin",
"service"
],
"token": {
"backend": "sql"
},
"users": {
"admin": {
"password": "admin",
"default_tenant": "admin",
"roles": {
"admin": [
"admin"
]
}
}
}
},
"image": {
"api": {
"bind_interface": "$glance_nic"
},
"debug": true,
"registry": {
"bind_interface": "$glance_nic"
},
"syslog": {
"use": false
},
"upload_image": {
"cirros": "http://download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-disk.img"
},
"upload_images": [
"cirros"
]
},
"memcached_servers": [
"$controller_mgmt_ip:11211"
],
"mq": {
"user": "guest",
"password": "test",
"vhost": "/nova",
"network": {
"service_type": "rabbitmq"
}
}
}
}
}

View File

@@ -1,9 +0,0 @@
{
"override_attributes": {
"endpoints": {
"compute-vnc-bind": {
"host":"$host.deployed_package_config.roles_mapping.os_compute.management.ip"
}
}
}
}

View File

@@ -0,0 +1,9 @@
{
"override": {
"openstack": {
"endpoints": {
"bind-host": "$os_compute_worker.management.ip"
}
}
}
}

View File

@@ -1,18 +1,18 @@
{
"name": "$host.hostname",
"hostname": "$host.hostname",
"profile": "$host.profile",
"gateway": "$host.gateway",
"name": "$hostname",
"hostname": "$hostname",
"profile": "$profile",
"gateway": "$gateway",
#import simplejson as json
#set nameservers = json.dumps($host.nameservers, encoding='utf-8')
#set nameservers = json.dumps($nameservers, encoding='utf-8')
"name_servers": $nameservers,
#set search_path = ' '.join($host.search_path)
#set search_path = ' '.join($search_path)
"name_servers_search": "$search_path",
"proxy": "$host.http_proxy",
"proxy": "$getVar('http_proxy', '')",
"modify_interface":
#set networks = $host.networks
#set networks = $networks
#set rekeyed = {}
#set promicnic = ""
#set promic_nic = ""
#for $nic, $val in $networks.iteritems():
#set ip_key = '-'.join(('ipaddress', $nic))
#set netmask_key = '-'.join(('netmask', $nic))
@@ -24,13 +24,13 @@
#set $rekeyed[$static_key] = True
#if $val.is_promiscuous:
#set promicnic = $nic
#set promic_nic = $nic
#end if
#if $val.is_mgmt:
#set mac_key = '-'.join(('macaddress', $nic))
#set dns_key = '-'.join(('dns', $nic))
#set $rekeyed[$mac_key] = $host.mac
#set $rekeyed[$dns_key] = $host.dns
#set $rekeyed[$mac_key] = $mac
#set $rekeyed[$dns_key] = $dns
#end if
#end for
#set nic_info = json.dumps($rekeyed, encoding='utf-8')
@@ -38,7 +38,7 @@
,
"ksmeta":{
#set partition_config = ''
#for k, v in $host.partition.iteritems():
#for k, v in $partition.iteritems():
#set path = ''
#if v['vol_percentage']:
#set $path = k + ' ' + str(v['vol_percentage']) + '%'
@@ -49,15 +49,15 @@
#end for
#set partition_config = partition_config[1:]
#import crypt
#set $password = crypt.crypt($host.server_credentials.password, "az")
#set no_proxy = ','.join($host.no_proxy)
"username": "$host.server_credentials.username",
#set $password = crypt.crypt($server_credentials.password, "az")
#set no_proxy = ','.join($getVar('no_proxy', []))
"username": "$server_credentials.username",
"password": "$password",
"promisc_nics": "$promicnic",
"promisc_nics": "$promic_nic",
"partition": "$partition_config",
"https_proxy": "$host.https_proxy",
"ntp_server": "$host.ntp_server",
"timezone": "$host.timezone",
"https_proxy": "$getVar('https_proxy', '')",
"ntp_server": "$ntp_server",
"timezone": "$timezone",
"ignore_proxy": "$no_proxy"
}
}

View File

@@ -1,63 +1,36 @@
{
"name": "$host.hostname",
"hostname": "$host.hostname",
"profile": "$host.profile",
"gateway": "$host.gateway",
#import simplejson as json
#set nameservers = json.dumps($host.nameservers, encoding='utf-8')
"name_servers": $nameservers,
#set search_path = ' '.join($host.search_path)
"name": "$fullname",
"hostname": "$hostname",
"profile": "$profile",
"gateway": "$gateway",
"name_servers": "$name_servers",
"name_servers_search": "$search_path",
"proxy": "$host.http_proxy",
"proxy": "$getVar('http_proxy', '')",
"modify_interface":
#set networks = $host.networks
#import simplejson
#set interfaces = $networks.interfaces
#set rekeyed = {}
#set promicnic = ""
#for $nic, $val in $networks.iteritems():
#set ip_key = '-'.join(('ipaddress', $nic))
#set netmask_key = '-'.join(('netmask', $nic))
#set mgmt_key = '-'.join(('management', $nic))
#set static_key = '-'.join(('static', $nic))
#set $rekeyed[$ip_key] = $val.ip
#set $rekeyed[$netmask_key] = $val.netmask
#set $rekeyed[$mgmt_key] = $val.is_mgmt
#set $rekeyed[$static_key] = True
#if $val.is_promiscuous:
#set promicnic = $nic
#end if
#if $val.is_mgmt:
#set mac_key = '-'.join(('macaddress', $nic))
#set dns_key = '-'.join(('dns', $nic))
#set $rekeyed[$mac_key] = $host.mac
#set $rekeyed[$dns_key] = $host.dns
#for $nic, $val in $interfaces.iteritems():
#set $rekeyed = { "ipaddress-vnet0" : $val.ip, "netmask-vnet0": $val.netmask, "management-vnet0": $val.is_mgmt, "static-vnet0" : True }
#if $val.is_mgmt:
#set $rekeyed["macaddress-vnet0"] = $mac_address
#set $rekeyed["dnsname-vnet0"] = $dns
#end if
#end for
#set nic_info = json.dumps($rekeyed, encoding='utf-8')
$nic_info
#set $str=simplejson.dumps($rekeyed, encoding='utf-8')
$str
,
"ksmeta":{
#set partition_config = ''
#for k, v in $host.partition.iteritems():
#set path = ''
#if v['vol_percentage']:
#set $path = k + ' ' + str(v['vol_percentage']) + '%'
#else:
#set $path = k + ' ' + str(v['vol_size'])
#end if
#set partition_config = ';'.join((partition_config, $path))
#end for
#set partition_config = partition_config[1:]
"username": "$server_credentials.username",
#import crypt
#set $password = crypt.crypt($host.server_credentials.password, "az")
#set no_proxy = ','.join($host.no_proxy)
"username": "$host.server_credentials.username",
#set $password = crypt.crypt($server_credentials.password, "az")
"password": "$password",
"promisc_nics": "$promicnic",
#set f=[(k + ' ' + v['vol_percentage'] or v['vol_size']) for k,v in $partition.iteritems()]
#set $partition_config = '; '.join($f)
"partition": "$partition_config",
"https_proxy": "$host.https_proxy",
"ntp_server": "$host.ntp_server",
"timezone": "$host.timezone",
"ignore_proxy": "$no_proxy"
"https_proxy": "$getVar('https_proxy', '')",
"ignore_proxy": "$getVar('ignore_proxy', '')",
"ntp_server": "$ntp_server"
}
}