1
. /usr/share/conjure-up/hooklib/common.sh
4
exposeResult "$1" 1 "false"
9
perl -lne 's/^nameserver\s+// or next; s/\s.*//; print && exit' /etc/resolv.conf
15
if ! neutron net-show ext-net > /dev/null 2>&1; then
16
debug openstack "adding ext-net"
17
if ! neutron net-create --router:external ext-net > /dev/null 2>&1; then
18
fail_cleanly "Neutron not ready yet..."
22
if ! neutron subnet-show ext-subnet > /dev/null 2>&1; then
23
debug openstack "adding ext-subnet"
24
if ! neutron subnet-create --name ext-subnet ext-net 10.99.0.0/24 \
25
--gateway 10.99.0.1 --disable-dhcp \
26
--allocation-pool start=10.99.0.3,end=10.99.0.254 > /dev/null 2>&1; then
27
fail_cleanly "Neutron not ready yet..."
31
if ! neutron net-show ubuntu-net > /dev/null 2>&1; then
32
debug openstack "adding ubuntu-net"
33
if ! neutron net-create ubuntu-net --shared > /dev/null 2>&1; then
34
fail_cleanly "Neutron not ready yet..."
38
if ! neutron subnet-show ubuntu-subnet > /dev/null 2>&1; then
39
debug openstack "adding ubuntu-subnet"
40
if ! neutron subnet-create --name ubuntu-subnet \
41
--gateway 10.101.0.1 \
42
--dns-nameserver $(get_host_ns) ubuntu-net 10.101.0.0/24 > /dev/null 2>&1; then
43
fail_cleanly "Neutron not ready yet..."
47
if ! neutron router-show ubuntu-router > /dev/null 2>&1; then
48
debug openstack "adding ubuntu-router"
49
if ! neutron router-create ubuntu-router > /dev/null 2>&1; then
50
fail_cleanly "Neutron not ready yet..."
54
if ! neutron router-interface-add ubuntu-router ubuntu-subnet > /dev/null 2>&1; then
55
debug openstack "Neutron not ready yet..."
58
debug openstack "setting router gateway"
59
if ! neutron router-gateway-set ubuntu-router ext-net > /dev/null 2>&1; then
60
debug openstack "Neutron not ready yet..."
63
# create pool of at least 5 floating ips
64
debug openstack "creating floating ips"
65
existingips=$(neutron floatingip-list -f csv | tail -n +2| wc -l)
66
to_create=$((10 - existingips))
68
while [ $i -ne $to_create ]; do
69
neutron floatingip-create ext-net > /dev/null 2>&1
73
# configure security groups
74
debug openstack "setting security roles"
75
neutron security-group-rule-create --direction ingress --ethertype IPv4 --protocol icmp --remote-ip-prefix 0.0.0.0/0 default > /dev/null 2>&1 || true
76
neutron security-group-rule-create --direction ingress --ethertype IPv4 --protocol tcp --port-range-min 22 --port-range-max 22 --remote-ip-prefix 0.0.0.0/0 default > /dev/null 2>&1 || true
77
debug openstack "neutron configured!"