-
Notifications
You must be signed in to change notification settings - Fork 4
/
post-installation.sh
executable file
·47 lines (38 loc) · 1.64 KB
/
post-installation.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#This post installation script will create a tenant network and launch vm under the network.
source userinput.sh
source admin-openrc
#openstack network create --share --external \
# --provider-physical-network provider \
# --provider-network-type flat externalnetwork
#openstack subnet create --network externalnetwork \
# --allocation-pool start=192.168.0.240,end=192.168.0.250 \
# --dns-nameserver 8.8.8.8 --gateway 192.168.0.1 \
# --subnet-range 192.168.0.0/24 externalsubnet
#create local network
openstack network create localnetwork
#create local subnet
openstack subnet create --network localnetwork \
--dns-nameserver 8.8.8.8 --gateway 10.0.0.1 \
--subnet-range 10.0.0.0/24 localsubnet
#create router and add local network interface to router
openstack router create router
neutron router-interface-add router localsubnet
#neutron router-gateway-set router externalnetwork
#create flavors
openstack flavor create --id 0 --vcpus 1 --ram 512 --disk 1 m1.nano
openstack flavor create --id 1 --vcpus 1 --ram 1024 --disk 10 m1.micro
openstack flavor create --id 2 --vcpus 1 --ram 2048 --disk 10 m1.small
#create security group
openstack security group rule create --proto icmp default
openstack security group rule create --proto tcp --dst-port 22 default
#launch instance
LOCAL_NET_ID=$(nova net-list | awk '/ localnetwork / { print $2 }')
openstack server create --flavor m1.nano --image cirros \
--nic net-id=$LOCAL_NET_ID --security-group default \
test-instance
openstack stack create -t demo-template.yml --parameter "NetID=$LOCAL_NET_ID" stack
sleep 10
openstack stack list
sleep 60
openstack stack output show --all stack
openstack server list