Skip to content

Commit 9a90fec

Browse files
committed
adding all the necessary files to make this easier
1 parent abd15da commit 9a90fec

File tree

4 files changed

+603
-0
lines changed

4 files changed

+603
-0
lines changed

lxd-bridge

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# WARNING: This file is generated by a debconf template!
2+
# It is recommended to update it by using "dpkg-reconfigure -p medium lxd"
3+
4+
# Whether to setup a new bridge or use an existing one
5+
USE_LXD_BRIDGE="true"
6+
7+
# Bridge name
8+
# This is still used even if USE_LXD_BRIDGE is set to false
9+
# set to an empty value to fully disable
10+
LXD_BRIDGE="lxdbr0"
11+
12+
# Update the "default" LXD profile
13+
UPDATE_PROFILE="true"
14+
15+
# Path to an extra dnsmasq configuration file
16+
LXD_CONFILE=""
17+
18+
# DNS domain for the bridge
19+
LXD_DOMAIN="lxd"
20+
21+
# IPv4
22+
## IPv4 address (e.g. 10.0.8.1)
23+
LXD_IPV4_ADDR="10.10.10.1"
24+
25+
## IPv4 netmask (e.g. 255.255.255.0)
26+
LXD_IPV4_NETMASK="255.255.254.0"
27+
28+
## IPv4 network (e.g. 10.0.8.0/24)
29+
LXD_IPV4_NETWORK="10.10.10.0/23"
30+
31+
## IPv4 DHCP range (e.g. 10.0.8.2,10.0.8.254)
32+
LXD_IPV4_DHCP_RANGE="10.10.10.10,10.10.11.253"
33+
34+
## IPv4 DHCP number of hosts (e.g. 250)
35+
LXD_IPV4_DHCP_MAX="500"
36+
37+
## NAT IPv4 traffic
38+
LXD_IPV4_NAT="true"
39+
40+
# IPv6
41+
## IPv6 address (e.g. 2001:470:b368:4242::1)
42+
LXD_IPV6_ADDR=""
43+
44+
## IPv6 CIDR mask (e.g. 64)
45+
LXD_IPV6_MASK=""
46+
47+
## IPv6 network (e.g. 2001:470:b368:4242::/64)
48+
LXD_IPV6_NETWORK=""
49+
50+
## NAT IPv6 traffic
51+
LXD_IPV6_NAT="false"
52+
53+
# Run a minimal HTTP PROXY server
54+
LXD_IPV6_PROXY="false"

openstack/configure-openstack

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
#!/bin/bash
2+
#
3+
# fortinet-configure-openstack
4+
# Copyright (C) 2016 Fortinet Ltd.
5+
#
6+
# Authors: Nicolas Thomss <nthomas fortinet.com>
7+
#
8+
# This program is free software: you can redistribute it and/or modify
9+
# it under the terms of the GNU General Public License as published by
10+
# the Free Software Foundation, version 3 of the License.
11+
#
12+
# This program is distributed in the hope that it will be useful,
13+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
# GNU General Public License for more details.
16+
#
17+
# You should have received a copy of the GNU General Public License
18+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
20+
set -ex
21+
22+
echo "This command is run to configure an Orange-Box Openstack deployment"
23+
24+
NEUTRON_EXT_NET_GW="10.10.10.1"
25+
NEUTRON_EXT_NET_CIDR="10.10.10.0/23"
26+
27+
NEUTRON_EXT_NET_NAME="ext_net" # Unused
28+
NEUTRON_DNS="192.168.0.254"
29+
NEUTRON_FLOAT_RANGE_START="10.10.11.12"
30+
NEUTRON_FLOAT_RANGE_END="10.10.11.253"
31+
32+
NEUTRON_FIXED_NET_CIDR="192.168.16.0/22"
33+
34+
35+
#Check if VIP is set on keystone
36+
keystone_VIP=`juju config keystone| python -c "import yaml; import sys; print yaml.load(sys.stdin)[\"settings\"][\"vip\"][\"value\"]"||true`
37+
38+
if [ -n "$keystone_VIP" ]
39+
then
40+
keystone=$keystone_VIP
41+
else
42+
#if os-public-hostname is set and not VIP assume we need to use those at OpenStack endpoints.
43+
keystone_PUBENDPOINT=`juju config keystone| python -c "import yaml; import sys; print yaml.load(sys.stdin)[\"settings\"][\"os-public-hostname\"][\"value\"]"||true`
44+
if [ -n "$keystone_PUBENDPOINT" ]
45+
then
46+
## will need to add the PUBENPOINT to the different services interfaces to enable access on ob-num+2 network.
47+
## Assume a fresh install where the unit ID is 0 keystone/0 for example (TO BE FIXED)
48+
unset DEVICE
49+
for service in keystone cinder glance neutron-api nova-cloud-controller ceph-radosgw
50+
do
51+
DEVICE=`juju ssh ${service}/0 "ip route" | grep 172.27.$((obnum+2)). |head -1 | awk '{ print $3}'`
52+
# assuming the os-public-name are IPs not names will fail if not set
53+
OSPUBLICIP=`juju config ${service}| python -c "import yaml; import sys; print yaml.load(sys.stdin)[\"settings\"][\"os-public-hostname\"][\"value\"]"||true`
54+
[ -n "$OSPUBLICIP" ] && juju ssh ${service}/0 "sudo ifconfig $DEVICE:1 $OSPUBLICIP"
55+
done
56+
keystone=$keystone_PUBENDPOINT
57+
else
58+
keystone=$(juju status keystone --format=yaml | grep public-address | head -1 | awk '{print $2}')
59+
fi
60+
fi
61+
62+
63+
echo "export SERVICE_ENDPOINT=http://$keystone:35357/v2.0/
64+
unset SERVICE_TOKEN
65+
unset SERVICE_ENDPOINT
66+
export OS_AUTH_URL=http://$keystone:35357/v2.0/
67+
export OS_USERNAME=$(juju config keystone | python -c "import yaml; import sys; print yaml.load(sys.stdin)[\"settings\"][\"admin-user\"][\"value\"]")
68+
export OS_PASSWORD=$(juju config keystone | python -c "import yaml; import sys; print yaml.load(sys.stdin)[\"settings\"][\"admin-password\"][\"value\"]")
69+
export OS_TENANT_NAME=admin
70+
export OS_REGION_NAME=$(juju config keystone | python -c "import yaml; import sys; print yaml.load(sys.stdin)[\"settings\"][\"region\"][\"value\"]")
71+
" > ~/nova.rc
72+
73+
source ~/nova.rc
74+
75+
# Determine the tenant id for the configured tenant name.
76+
export TENANT_ID="$(keystone tenant-list | grep $OS_TENANT_NAME | awk '{ print $2 }')"
77+
78+
if [ "$TENANT_ID" = "" ]; then
79+
echo "Unable to find tenant ID, keystone auth problem"
80+
exit
81+
fi
82+
83+
echo "Configuring Openstack Neutron Networking"
84+
85+
#create ext network with neutron for floating IPs
86+
neutron net-show ext_net > /dev/null 2>&1 || neutron net-create ext_net --tenant-id $TENANT_ID -- --router:external=True
87+
EXTERNAL_NETWORK_ID=$(neutron net-show ext_net | grep " id" | awk '{print $4}')
88+
neutron subnet-show ext_net_subnet > /dev/null 2>&1 || neutron subnet-create ext_net $NEUTRON_EXT_NET_CIDR --name ext_net_subnet --tenant-id $TENANT_ID \
89+
--allocation-pool start=$NEUTRON_FLOAT_RANGE_START,end=$NEUTRON_FLOAT_RANGE_END \
90+
--gateway $NEUTRON_EXT_NET_GW --disable-dhcp --dns_nameservers $NEUTRON_DNS list=true
91+
92+
#Create private network for neutron for tenant VMs
93+
neutron net-show private > /dev/null 2>&1 || neutron net-create private
94+
neutron subnet-show private_subnet > /dev/null 2>&1 || neutron subnet-create private $NEUTRON_FIXED_NET_CIDR -- --name private_subnet --dns_nameservers list=true $NEUTRON_DNS
95+
SUBNET_ID=$(neutron subnet-show private_subnet | grep " id" | awk '{print $4}')
96+
97+
#Create router for external network and private network
98+
neutron router-show provider-router > /dev/null 2>&1 || neutron router-create --tenant-id $TENANT_ID provider-router
99+
ROUTER_ID=$(neutron router-show provider-router | grep " id" | awk '{print $4}')
100+
101+
neutron router-gateway-clear provider-router || true
102+
neutron router-gateway-set $ROUTER_ID $EXTERNAL_NETWORK_ID
103+
## make it always ok to have it indempodent.
104+
neutron router-interface-add $ROUTER_ID $SUBNET_ID || true
105+
106+
107+
echo "Configuring security groups for access to ICMP, SSH and RDP by default"
108+
109+
#Configure the default security group to allow ICMP and SSH
110+
nova secgroup-list-rules default | grep icmp > /dev/null 2>&1 || nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0 > /dev/null 2>&1
111+
nova secgroup-list-rules default | grep 22 > /dev/null 2>&1 || nova secgroup-add-rule default tcp 22 22 0.0.0.0/0 > /dev/null 2>&1
112+
#for rdp
113+
nova secgroup-list-rules default | grep 3389 > /dev/null 2>&1 || nova secgroup-add-rule default tcp 3389 3389 0.0.0.0/0 > /dev/null 2>&1
114+
115+
116+
117+
echo "Uploading default SSH key"
118+
119+
#Upload a default SSH key
120+
nova keypair-list | grep default > /dev/null 2>&1 || nova keypair-add --pub-key ~/.ssh/id_rsa.pub default > /dev/null 2>&1
121+
122+
echo "Modifying the flavors to be better sized for the Orange Box"
123+
124+
#Modify the flavours to fit better on the OB
125+
#nova flavor-create FLAVOR_NAME FLAVOR_ID RAM_IN_MB ROOT_DISK_IN_GB NUMBER_OF_VCPUS
126+
nova flavor-delete m1.tiny > /dev/null 2>&1
127+
nova flavor-delete m1.small > /dev/null 2>&1
128+
nova flavor-delete m1.medium > /dev/null 2>&1
129+
nova flavor-delete m1.large > /dev/null 2>&1
130+
nova flavor-delete m1.xlarge > /dev/null 2>&1
131+
nova flavor-create --is-public true m1.tiny auto 512 5 1 > /dev/null 2>&1
132+
nova flavor-create --is-public true m1.small auto 1024 10 1 > /dev/null 2>&1
133+
nova flavor-create --is-public true m1.medium auto 2048 10 2 > /dev/null 2>&1
134+
nova flavor-create --is-public true m1.large auto 3072 10 2 > /dev/null 2>&1
135+
## need extra for windows image (15g)
136+
nova flavor-create --is-public true m1.xlarge auto 8096 30 4 > /dev/null 2>&1
137+
138+
echo "modifying default quotas for admin user"
139+
140+
#Modify quotas for the tenant to allow large deployments
141+
nova quota-update --instances 400 $TENANT_ID
142+
nova quota-update --cores 800 $TENANT_ID
143+
nova quota-update --ram 404800 $TENANT_ID
144+
nova quota-update --security-groups 4000 $TENANT_ID
145+
nova quota-update --floating_ips -1 $TENANT_ID
146+
nova quota-update --security-group-rules -1 $TENANT_ID
147+
148+
### need to find how to change quota for the project not the tenant
149+
150+
### modify default quota the same way..
151+
nova quota-class-update --instances 400 $TENANT_ID
152+
nova quota-class-update --cores 800 $TENANT_ID
153+
nova quota-class-update --ram 404800 $TENANT_ID
154+
nova quota-class-update --security-groups 4000 $TENANT_ID
155+
nova quota-class-update --floating_ips -1 $TENANT_ID
156+
nova quota-class-update --security-group-rules -1 $TENANT_ID
157+
158+
echo "Uploading images to glance"
159+
160+
#Upload images to glance
161+
#openstack image create --disk-format qcow2 --container-format ovf --public "Trusty x86_64" --file /srv/data/trusty-server-cloudimg-amd64-disk1.img
162+
163+
openstack image show "Precise x86_64" > /dev/null 2>&1 || openstack image create --disk-format qcow2 --container-format bare --public "Precise x86_64" --file /srv/data/precise-server-cloudimg-amd64-disk1.img
164+
openstack image show "Trusty x86_64" > /dev/null 2>&1 || openstack image create --disk-format qcow2 --container-format bare --public "Trusty x86_64" --file /srv/data/trusty-server-cloudimg-amd64-disk1.img
165+
openstack image show "Centos 7 x86_64" > /dev/null 2>&1 || openstack image create --disk-format qcow2 --container-format bare --public "Centos 7 x86_64" --file /srv/data/CentOS-7-x86_64-GenericCloud.qcow2
166+
167+
168+
#glance image-create --name="Precise x86_64" --is-public=true --container-format=ovf --disk-format=qcow2 < /srv/data/precise-server-cloudimg-amd64-disk1.img
169+
#glance image-show "Trusty x86_64" > /dev/null 2>&1 || glance image-create --name="Trusty x86_64" --is-public=true --container-format=ovf --disk-format=qcow2 < /srv/data/trusty-server-cloudimg-amd64-disk1.img
170+
#glance image-show "Xenial x86_64" > /dev/null 2>&1 || glance image-create --name="Xenial x86_64" --is-public=true --container-format=ovf --disk-format=qcow2 < /srv/data/xenial-server-cloudimg-amd64-disk1.img
171+
172+
#glance image-show "CentOS 6.4" > /dev/null 2>&1 || glance image-create --name="CentOS 6.4" --is-public=true --container-format=bare --disk-format=qcow2 < /srv/data/centos6.4-x86_64-gold-master.img
173+
#glance image-show "Cirros 0.3" > /dev/null 2>&1 || glance image-create --name="Cirros 0.3" --is-public=true --container-format=bare --disk-format=qcow2 < /srv/data/cirros-0.3.2-x86_64-disk.img
174+
## image name is used by script to generate metadata .. don't screw the series
175+
#glance image-show "win2012r2" > /dev/null 2>&1 || gzip -cd /srv/data/windows_server_2012_r2_standard_eval_kvm_20151021.qcow2.gz |glance image-create --name="Windows Server 2012" --is-public=true --container-format=bare --disk-format=qcow2
176+
177+
178+
## working
179+
#glance image-create --name "Cirros 0.3" --progress --visibility public --disk-format=qcow2 --container-format=bare --file /srv/data/cirros-0.3.2-x86_64-disk.img
180+
## must modify glance service to allow insecure upload
181+
exit

openstack/get-cloud-images

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash -e
2+
3+
4+
5+
folder=/srv/data/
6+
URLS="http://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64-disk1.img \
7+
http://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img \
8+
http://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img \
9+
http://mirror.catn.com/pub/catn/images/qcow2/centos6.4-x86_64-gold-master.img \
10+
http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2 \
11+
http://download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-disk.img "
12+
13+
for URL in $URLS
14+
do
15+
FILENAME=${URL##*/}
16+
if [ -f $folder/$FILENAME ];
17+
then
18+
echo "$FILENAME already downloaded."
19+
else
20+
wget -O $folder/$FILENAME $URL
21+
fi
22+
done
23+
24+
25+
echo "To download Windows image get there : https://cloudbase.it/windows-cloud-images/"

0 commit comments

Comments
 (0)