Add undercloud-stack-config element

This commit is contained in:
James Slagle 2014-02-18 17:12:58 -05:00
parent d9f08dc785
commit a119ca5477
6 changed files with 213 additions and 0 deletions

View File

@ -0,0 +1,2 @@
Provide configuration for the undercloud
-----------------------------------------

View File

@ -0,0 +1,96 @@
{
"OpenStack::Heat::Stack": {
},
"admin-password": "unset",
"admin-token": "unset",
"db-password": "unset",
"local-ipv4": "{{LOCAL_IP}}",
"keystone": {
"host": "127.0.0.1",
"db": "mysql://keystone:unset@localhost/keystone"
},
"rabbit": {
"host": "127.0.0.1",
"password": "guest"
},
"glance": {
"backend": "file",
"host": "127.0.0.1",
"db": "mysql://glance:unset@localhost/glance",
"service-password": "unset"
},
"nova": {
"compute_hostname": "undercloud",
"host": "127.0.0.1",
"db": "mysql://nova:unset@localhost/nova",
"compute_driver": "baremetal.driver.BareMetalDriver",
"tuning": {
"ram_allocation_ratio": "1.0",
"reserved_host_memory_mb": "0"
},
"baremetal": {
"arch": "amd64",
"db": "mysql://nova:unset@localhost/nova_bm",
"power_manager": "{{POWER_DRIVER}}",
"pxe_deploy_timeout": "2400",
"use_file_injection": "False",
"virtual_power": {
"user": "{{VIRTUAL_POWER_USER}}",
"key": "/opt/stack/boot-stack/virtual-power-key",
"ssh_host": "{{VIRTUAL_POWER_HOST}}",
"type": "virsh"
}
},
"metadata-proxy": "false",
"service-password": "unset"
},
"bootstack": {
"public_interface_ip": "{{LOCAL_IP}}/24",
"masquerade_networks": ["{{MASQUERADE_NETWORK}}"]
},
"cinder": {
"db": "mysql://cinder:unset@localhost/cinder",
"volume_size_mb": "5000",
"service-password": "unset"
},
"neutron": {
"host": "127.0.0.1",
"ovs_db": "mysql://neutron:unset@localhost/ovs_neutron?charset=utf8",
"ovs": {
"bridge_mappings": "ctlplane:br-ctlplane",
"dnsmasq_range": ["192.0.2.4", "192.0.2.4"],
"enable_tunneling": "False",
"network_vlan_ranges": "ctlplane",
"physical_bridge": "br-ctlplane",
"physical_network": "ctlplane",
"public_interface": "{{LOCAL_INTERFACE}}",
"tenant_network_type": "vlan"
},
"service-password": "unset",
"dhcp_start": "{{DHCP_START}}",
"dhcp_end": "{{DHCP_END}}",
"network_cidr": "{{NETWORK_CIDR}}",
"network_gateway": "{{NETWORK_GATEWAY}}"
},
"heat": {
"db": "mysql://heat:unset@localhost/heat",
"auth_encryption_key": "unset___________",
"watch_server_url": "http://{{LOCAL_IP}}:8003",
"waitcondition_server_url": "http://{{LOCAL_IP}}:8000/v1/waitcondition",
"metadata_server_url": "http://{{LOCAL_IP}}:8000",
"admin_tenant_name": "service",
"admin_user": "heat",
"admin_password": "unset"
},
"horizon": {
"secret_key": "unset___________"
},
"tuskar": {
"db": "mysql://tuskar:unset@localhost/tuskar?charset=utf8",
"heat_keystone": {
"username": "admin",
"password": "unset",
"tenant_name": "admin"
}
}
}

View File

@ -0,0 +1,3 @@
os-refresh-config
tripleo-heat-templates
tripleo-incubator

View File

@ -0,0 +1,5 @@
#!/bin/bash
set -eux
install-packages pystache

View File

@ -0,0 +1,35 @@
#!/usr/bin/python
import os
import pystache
renderer = pystache.Renderer()
template = os.path.join(os.path.dirname(__file__),
'..',
'config.json.template')
context = {
'LOCAL_IP': os.environ.get('LOCAL_IP', '192.0.2.1'),
'LOCAL_INTERFACE': os.environ.get('LOCAL_INTERFACE', 'eth1'),
'DNSMASQ_START': os.environ.get('DNSMASQ_START', '192.0.2.4'),
'DNSMASQ_END': os.environ.get('DNSMASQ_END', '192.0.2.4'),
'MASQUERADE_NETWORK': os.environ.get('MASQUERADE_NETWORK', '192.0.2.0/24'),
'POWER_DRIVER': os.environ.get('POWER_DRIVER', 'nova.virt.baremetal.ipmi.IPMI'),
'VIRTUAL_POWER_USER': os.environ.get('VIRTUAL_POWER_USER', 'stack'),
'VIRTUAL_POWER_HOST': os.environ.get('VIRTUAL_POWER_HOST', '192.168.122.1'),
'DHCP_START': os.environ.get('DHCP_START', '192.0.2.5'),
'DHCP_END': os.environ.get('DHCP_END', '192.0.2.24'),
'NETWORK_CIDR': os.environ.get('NETWORK_CIDR', '192.0.2.0/24'),
'NETWORK_GATEWAY': os.environ.get('NETWORK_GATEWAY', '192.0.2.1'),
}
with open(template) as f:
config_json = renderer.render(f.read(), context)
cfn_path = '/var/lib/heat-cfntools/cfn-init-data'
os.makedirs(os.path.dirname(cfn_path))
with open(cfn_path, 'w') as f:
f.write(config_json)

View File

@ -0,0 +1,72 @@
#!/bin/bash
set -eux
OK_FILE=/opt/stack/.undercloud-setup
if [ -f $OK_FILE ]; then
exit
fi
source /root/stackrc
# Add scripts directory from tripleo-incubator to the path.
if [ ! -e /etc/profile.d/tripleo-incubator-scripts.sh ]; then
echo export PATH=\$PATH:/opt/stack/tripleo-incubator/scripts/ >> \
/etc/profile.d/tripleo-incubator-scripts.sh
fi
# Make sure we have the latest $PATH set.
source /etc/profile.d/tripleo-incubator-scripts.sh
if [ ! -f /root/.ssh/authorized_keys ]; then
sudo mkdir -p /root/.ssh
sudo chmod 7000 /root/.ssh/
sudo touch /root/.ssh/authorized_keys
sudo chmod 600 /root/.ssh/authorized_keys
fi
if [ ! -f /root/.ssh/id_rsa ]; then
ssh-keygen -b 1024 -N '' -f /root/.ssh/id_rsa
fi
cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
KEYSTONE_SERVICE=keystone
if [ -f /lib/systemd/system/openstack-keystone.service ]; then
KEYSTONE_SERVICE=openstack-keystone
fi
# Ensure keystone is up before continuing on.
# Waits for up to 2 minutes.
wait_for 12 10 service $KEYSTONE_SERVICE status
# Because keystone just still isn't up yet...
sleep 20
export UNDERCLOUD_IP=$(os-apply-config --key local-ipv4 --type netaddress)
init-keystone -p unset unset \
$UNDERCLOUD_IP admin@example.com root@$UNDERCLOUD_IP
setup-endpoints \
$UNDERCLOUD_IP \
--glance-password unset \
--heat-password unset \
--neutron-password unset \
--nova-password unset
keystone role-create --name heat_stack_user
DHCP_START=$(os-apply-config --key neutron.dhcp_start --type netaddress)
DHCP_END=$(os-apply-config --key neutron.dhcp_end --type netaddress)
NETWORK_CIDR=$(os-apply-config --key neutron.network_cidr --type raw)
NETWORK_GATEWAY=$(os-apply-config --key neutron.network_gateway --type netaddress)
METADATA_SERVER=$UNDERCLOUD_IP
PHYSICAL_NETWORK=ctlplane
setup-neutron $DHCP_START $DHCP_END \
$NETWORK_CIDR $NETWORK_GATEWAY \
$METADATA_SERVER $PHYSICAL_NETWORK
touch $OK_FILE