Merge lp:~thomnico/sademos/juju-on-openstack-resumed into lp:sademos/16.04
- juju-on-openstack-resumed
- Merge into 16.04
Status: | Needs review |
---|---|
Proposed branch: | lp:~thomnico/sademos/juju-on-openstack-resumed |
Merge into: | lp:sademos/16.04 |
Diff against target: |
474 lines (+240/-107) 5 files modified
00-bootstrap.sh (+1/-1) openstack/01-deploy.sh (+4/-8) openstack/configure-juju-on-openstack (+106/-51) openstack/get-cloud-images (+5/-4) openstack/orange-box-configure-openstack (+124/-43) |
To merge this branch: | bzr merge lp:~thomnico/sademos/juju-on-openstack-resumed |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
CPE SA | Pending | ||
Review via email: mp+297745@code.launchpad.net |
Commit message
Description of the change
Nicolas Thomas (thomnico) wrote : | # |
Good catch,
It is a remains of the offline work that I plan to provide separately
to avoid a huge review.
Will remove from now
On Fri, Jun 17, 2016 at 3:15 PM, M.Morana <email address hidden> wrote:
> Noticed one thing on a quick overview:
>
> openstack/
>
> +juju set-model-config cloudimg-base-url=http://
> 31
>
> ^static IP, I'm guessing you have OB60?
>
> Note: for grabbing the cloud images from /srv/, definitely the way to go but would be nice to have a checksum check to ensure they were all downloaded properly the first time although testing one's setup would reveal this problem also.
> --
> https:/
> You are the owner of lp:~thomnico/sademos/juju-on-openstack-resumed.
--
Best Regards,
Nicolas Thomas
http://
EMEA Solution Architect Canonical
GPG FPR: D592 4185 F099 9031 6590 6292 492F C740 F03A 7EB9
- 95. By Nicolas Thomas
-
Remove the off-line related part.
clean up the codemodified:
openstack/01-deploy. sh - 96. By Nicolas Thomas
-
Add Xenial to the mix ..
modified:
openstack/get-cloud- images
Scott Croft (secroft) wrote : | # |
Also, with juju 2.0, it's add-model now
On Jun 17, 2016 08:30, "Nicolas Thomas" <email address hidden>
wrote:
> Good catch,
>
> It is a remains of the offline work that I plan to provide separately
> to avoid a huge review.
>
> Will remove from now
>
> On Fri, Jun 17, 2016 at 3:15 PM, M.Morana <email address hidden> wrote:
> > Noticed one thing on a quick overview:
> >
> > openstack/
> >
> > +juju set-model-config cloudimg-base-url=
> http://
> > 31
> >
> > ^static IP, I'm guessing you have OB60?
> >
> > Note: for grabbing the cloud images from /srv/, definitely the way to go
> but would be nice to have a checksum check to ensure they were all
> downloaded properly the first time although testing one's setup would
> reveal this problem also.
> > --
> >
> https:/
> > You are the owner of lp:~thomnico/sademos/juju-on-openstack-resumed.
>
>
>
> --
> Best Regards,
> Nicolas Thomas
> http://
> EMEA Solution Architect Canonical
> GPG FPR: D592 4185 F099 9031 6590 6292 492F C740 F03A 7EB9
>
>
> https:/
> Your team CPE SA is requested to review the proposed merge of
> lp:~thomnico/sademos/juju-on-openstack-resumed into lp:sademos/16.04.
>
- 97. By Nicolas Thomas
-
fix create to add model
Nicolas Thomas (thomnico) wrote : | # |
Fixed
Lost in translating to a limited scope ...
On Fri, Jun 17, 2016 at 3:48 PM, Scott Croft <email address hidden> wrote:
> Also, with juju 2.0, it's add-model now
> On Jun 17, 2016 08:30, "Nicolas Thomas" <email address hidden>
> wrote:
>
>> Good catch,
>>
>> It is a remains of the offline work that I plan to provide separately
>> to avoid a huge review.
>>
>> Will remove from now
>>
>> On Fri, Jun 17, 2016 at 3:15 PM, M.Morana <email address hidden> wrote:
>> > Noticed one thing on a quick overview:
>> >
>> > openstack/
>> >
>> > +juju set-model-config cloudimg-base-url=
>> http://
>> > 31
>> >
>> > ^static IP, I'm guessing you have OB60?
>> >
>> > Note: for grabbing the cloud images from /srv/, definitely the way to go
>> but would be nice to have a checksum check to ensure they were all
>> downloaded properly the first time although testing one's setup would
>> reveal this problem also.
>> > --
>> >
>> https:/
>> > You are the owner of lp:~thomnico/sademos/juju-on-openstack-resumed.
>>
>>
>>
>> --
>> Best Regards,
>> Nicolas Thomas
>> http://
>> EMEA Solution Architect Canonical
>> GPG FPR: D592 4185 F099 9031 6590 6292 492F C740 F03A 7EB9
>>
>>
>> https:/
>> Your team CPE SA is requested to review the proposed merge of
>> lp:~thomnico/sademos/juju-on-openstack-resumed into lp:sademos/16.04.
>>
>
> --
> https:/
> You are the owner of lp:~thomnico/sademos/juju-on-openstack-resumed.
--
Best Regards,
Nicolas Thomas
http://
EMEA Solution Architect Canonical
GPG FPR: D592 4185 F099 9031 6590 6292 492F C740 F03A 7EB9
Unmerged revisions
- 97. By Nicolas Thomas
-
fix create to add model
- 96. By Nicolas Thomas
-
Add Xenial to the mix ..
modified:
openstack/get-cloud- images - 95. By Nicolas Thomas
-
Remove the off-line related part.
clean up the codemodified:
openstack/01-deploy. sh - 94. By Nicolas Thomas
-
Rework the configure openstack to collect info from juju (no more passwd issues)
Set to use 172.72.(obnum+1) (need the range to be free TBC).
If setting VIP or os-public use it for nova (usefull for 2 network scenario).
Update Windows..Rename to configure-
juju-on- opnestack as it has nothing OB specific .. YES !!
Move to use swift for metadata and generate metadata for images created (juju doc is misleading).renamed:
openstack/orange- box-launch- openstack- juju => openstack/ configure- juju-on- openstack
modified:
00-bootstrap.sh
openstack/01-deploy. sh
openstack/orange- box-configure- openstack
openstack/configure- juju-on- openstack
Preview Diff
1 | === modified file '00-bootstrap.sh' | |||
2 | --- 00-bootstrap.sh 2016-04-21 20:21:52 +0000 | |||
3 | +++ 00-bootstrap.sh 2016-06-17 14:41:49 +0000 | |||
4 | @@ -11,7 +11,7 @@ | |||
5 | 11 | 11 | ||
6 | 12 | obnum=`hostname | cut -c 10- -` | 12 | obnum=`hostname | cut -c 10- -` |
7 | 13 | 13 | ||
9 | 14 | time juju bootstrap --to node00vm0ob${obnum}.maas --show-log --upload-tools maas-controller maas/172.27.${obnum}.1 | 14 | time juju bootstrap --to node00vm0ob${obnum}.maas --show-log maas-controller maas/172.27.${obnum}.1 |
10 | 15 | time juju switch admin | 15 | time juju switch admin |
11 | 16 | 16 | ||
12 | 17 | URL=`juju gui --no-browser` | 17 | URL=`juju gui --no-browser` |
13 | 18 | 18 | ||
14 | === modified file 'openstack/01-deploy.sh' | |||
15 | --- openstack/01-deploy.sh 2016-04-21 19:55:54 +0000 | |||
16 | +++ openstack/01-deploy.sh 2016-06-17 14:41:49 +0000 | |||
17 | @@ -4,14 +4,10 @@ | |||
18 | 4 | 4 | ||
19 | 5 | model=`juju list-models |awk '{print $1}'|grep openstack` | 5 | model=`juju list-models |awk '{print $1}'|grep openstack` |
20 | 6 | 6 | ||
29 | 7 | if [ ${model} = "openstack" ]; then | 7 | [ "${model}" == "openstack" ] || juju add-model openstack |
30 | 8 | juju switch openstack | 8 | juju switch openstack |
31 | 9 | juju deploy openstack-liberty.yaml | 9 | |
32 | 10 | else | 10 | juju deploy openstack-liberty.yaml |
25 | 11 | juju create-model openstack | ||
26 | 12 | juju switch openstack | ||
27 | 13 | juju deploy openstack-liberty.yaml | ||
28 | 14 | fi | ||
33 | 15 | 11 | ||
34 | 16 | juju show-controllers --show-passwords|egrep "user|password" | 12 | juju show-controllers --show-passwords|egrep "user|password" |
35 | 17 | 13 | ||
36 | 18 | 14 | ||
37 | === renamed file 'openstack/orange-box-launch-openstack-juju' => 'openstack/configure-juju-on-openstack' | |||
38 | --- openstack/orange-box-launch-openstack-juju 2015-10-09 18:44:36 +0000 | |||
39 | +++ openstack/configure-juju-on-openstack 2016-06-17 14:41:49 +0000 | |||
40 | @@ -3,7 +3,7 @@ | |||
41 | 3 | # orange-box-launch-openstack-juju | 3 | # orange-box-launch-openstack-juju |
42 | 4 | # Copyright (C) 2014 Canonical Ltd. | 4 | # Copyright (C) 2014 Canonical Ltd. |
43 | 5 | # | 5 | # |
45 | 6 | # Authors: Darryl Weaver <darryl.weaver@canonical.com> | 6 | # Authors: Nicolas Thomss <nicolas.thomas@canonical.com> |
46 | 7 | # | 7 | # |
47 | 8 | # This program is free software: you can redistribute it and/or modify | 8 | # This program is free software: you can redistribute it and/or modify |
48 | 9 | # it under the terms of the GNU General Public License as published by | 9 | # it under the terms of the GNU General Public License as published by |
49 | @@ -17,70 +17,123 @@ | |||
50 | 17 | # You should have received a copy of the GNU General Public License | 17 | # You should have received a copy of the GNU General Public License |
51 | 18 | 18 | ||
52 | 19 | set -ex | 19 | set -ex |
53 | 20 | ## TODO use sudo apt-get install python-openstackclient instead | ||
54 | 21 | ## examples: | ||
55 | 22 | ## openstack ip floating list --format=csv | ||
56 | 23 | ## openstack ip floating create --format=shell ext_net | ||
57 | 24 | ## to avoid table parsing.. | ||
58 | 25 | ## openstack server show -c status --format value my-instance-name | ||
59 | 26 | |||
60 | 20 | 27 | ||
61 | 21 | echo "This command is run to launch the first instance on a new Orange box Openstack deployment" | 28 | echo "This command is run to launch the first instance on a new Orange box Openstack deployment" |
62 | 22 | 29 | ||
63 | 23 | source ~/nova.rc | 30 | source ~/nova.rc |
64 | 24 | 31 | ||
65 | 32 | |||
66 | 25 | #Create a floating IP for the instance | 33 | #Create a floating IP for the instance |
69 | 26 | FLOAT_IP="$(nova floating-ip-create | grep ext_net | awk '{ print $2}')" | 34 | if ( nova list | grep jumpserver2 >/dev/null ) |
70 | 27 | 35 | then | |
71 | 36 | FLOAT_IP="$(nova list | grep jumpserver2 | awk '{ print $13 }')" | ||
72 | 37 | else | ||
73 | 38 | FLOAT_IP="$(nova floating-ip-create | grep ext_net | awk 'BEGIN { FS = "|" } ; { print $2}'|tr -d '[[:space:]]')" | ||
74 | 39 | fi | ||
75 | 40 | |||
76 | 28 | #Launch an instance | 41 | #Launch an instance |
77 | 29 | NET_UUID="$(nova net-list | grep private | awk '{ print $2 }')" | 42 | NET_UUID="$(nova net-list | grep private | awk '{ print $2 }')" |
82 | 30 | IMAGE_UUID="$(nova image-list | grep Trusty | awk '{ print $2 }')" | 43 | IMAGE_UUID="$(nova image-list | grep Xenial | awk '{ print $2 }')" |
83 | 31 | nova boot --flavor 2 --key_name default --image $IMAGE_UUID --nic net-id=$NET_UUID --security_group default jumpserver | 44 | nova list | grep jumpserver2 ||nova boot --flavor m1.small --key_name default --image $IMAGE_UUID --nic net-id=$NET_UUID --security_group default jumpserver2 |
84 | 32 | sleep 40 | 45 | # checking jumpserver2 state until active .. |
85 | 33 | 46 | INST_STATE=` nova show jumpserver2 | grep status | awk '{print $4}'` | |
86 | 47 | while [ $INST_STATE != "ACTIVE" ]; | ||
87 | 48 | do | ||
88 | 49 | INST_STATE=` nova show jumpserver2 | grep status | awk '{print $4}'` | ||
89 | 50 | echo "Jumpserver2 instance state is: "$INST_STATE" waiting to be active" | ||
90 | 51 | sleep 1 | ||
91 | 52 | done | ||
92 | 53 | sleep 6 | ||
93 | 34 | #Associate the floating IP with the new instance | 54 | #Associate the floating IP with the new instance |
95 | 35 | nova floating-ip-associate jumpserver $FLOAT_IP | 55 | nova floating-ip-associate jumpserver2 $FLOAT_IP || true |
96 | 36 | sleep 10 | 56 | sleep 10 |
97 | 57 | |||
98 | 58 | ### make it more Readable | ||
99 | 59 | export SSH="ssh -o StrictHostKeyChecking=no ubuntu@$FLOAT_IP" | ||
100 | 60 | |||
101 | 61 | |||
102 | 62 | #Add juju stable repo | ||
103 | 63 | $SSH sudo add-apt-repository -y ppa:juju/stable | ||
104 | 64 | |||
105 | 37 | #SSH into the instance and install Juju | 65 | #SSH into the instance and install Juju |
110 | 38 | ssh -o StrictHostKeyChecking=no ubuntu@$FLOAT_IP sudo apt-get -y install juju-core juju-quickstart juju-deployer | 66 | $SSH sudo apt-get -y update |
111 | 39 | 67 | ||
112 | 40 | #Set up the Juju default environment | 68 | $SSH sudo apt-get -y install juju python-novaclient python-swiftclient |
113 | 41 | ssh -o StrictHostKeyChecking=no ubuntu@$FLOAT_IP juju init | 69 | |
114 | 42 | 70 | ||
115 | 43 | #copy over SSH keys | 71 | #copy over SSH keys |
142 | 44 | scp -o StrictHostKeyChecking=no ~/.ssh/id_rsa* ubuntu@$FLOAT_IP: | 72 | scp -o StrictHostKeyChecking=no ~/.ssh/id_rsa* ubuntu@$FLOAT_IP:~/.ssh/ |
143 | 45 | 73 | ||
144 | 46 | #Output a juju env file that works on this cloud | 74 | |
145 | 47 | ssh -o StrictHostKeyChecking=no ubuntu@$FLOAT_IP "echo 'default: openstack | 75 | #Output a juju cloud file that works on this cloud |
146 | 48 | environments: | 76 | $SSH \ |
147 | 49 | openstack: | 77 | "echo 'clouds: |
148 | 50 | type: openstack | 78 | openstack: |
149 | 51 | use-floating-ip: true | 79 | type: openstack |
150 | 52 | network: private | 80 | auth-types: [access-key, userpass] |
151 | 53 | auth-url: $OS_AUTH_URL | 81 | regions: |
152 | 54 | tenant-name: $OS_TENANT_NAME | 82 | $OS_REGION_NAME: |
153 | 55 | region: $OS_REGION_NAME | 83 | endpoint: $OS_AUTH_URL |
154 | 56 | auth-mode: userpass | 84 | ' > os-cloud.yaml" |
155 | 57 | username: $OS_USERNAME | 85 | $SSH juju add-cloud openstack os-cloud.yaml |
156 | 58 | password: $OS_PASSWORD | 86 | |
157 | 59 | admin-secret: $OS_PASSWORD | 87 | #Output a juju cred file that works on this cloud |
158 | 60 | default-series: trusty | 88 | $SSH \ |
159 | 61 | http-proxy: http://10.14.4.1:8000 | 89 | "echo 'credentials: |
160 | 62 | https-proxy: http://10.14.4.1:8000 | 90 | openstack: |
161 | 63 | ftp-proxy: http://10.14.4.1:8000 | 91 | openstack: |
162 | 64 | no-proxy: localhost,10.14.4.1 | 92 | auth-type: userpass |
163 | 65 | apt-http-proxy: http://10.14.4.1:8000 | 93 | password: $OS_PASSWORD |
164 | 66 | apt-https-proxy: http://10.14.4.1:8000 | 94 | tenant-name: $OS_TENANT_NAME |
165 | 67 | apt-ftp-proxy: http://10.14.4.1:8000 | 95 | username: $OS_USERNAME |
166 | 68 | ' > ~/.juju/environments.yaml" | 96 | ' > os-creds.yaml" |
167 | 69 | 97 | ||
168 | 98 | $SSH "juju add-credential openstack -f os-creds.yaml" | ||
169 | 99 | |||
170 | 100 | ## Creating images metadata | ||
171 | 101 | $SSH mkdir -p ~/juju-meta | ||
172 | 102 | for s in precise trusty xenial win2012r2 | ||
173 | 103 | do | ||
174 | 70 | #Create juju metadata | 104 | #Create juju metadata |
180 | 71 | ssh -o StrictHostKeyChecking=no ubuntu@$FLOAT_IP "juju-metadata generate-image -a amd64 -u $OS_AUTH_URL -i $IMAGE_UUID -r $OS_REGION_NAME -s trusty" | 105 | IMAGE_UUID="$(nova image-list | grep -i $s | awk '{ print $2 }')" |
181 | 72 | 106 | [ -n "$IMAGE_UUID" ] && $SSH "juju metadata generate-image -a amd64 -u $OS_AUTH_URL -i $IMAGE_UUID -r $OS_REGION_NAME -d juju-meta/ -s $s" | |
182 | 73 | IMAGE_UUID="$(nova image-list | grep Precise | awk '{ print $2 }')" | 107 | done |
183 | 74 | ssh -o StrictHostKeyChecking=no ubuntu@$FLOAT_IP "juju-metadata generate-image -a amd64 -u $OS_AUTH_URL -i $IMAGE_UUID -r $OS_REGION_NAME -s precise" | 108 | |
184 | 75 | 109 | ## Generate tools (needed if windows is in). | |
185 | 110 | $SSH "juju metadata generate-tools -d juju-meta/ " | ||
186 | 111 | |||
187 | 112 | ## upload images and tools streams to swift and make public | ||
188 | 113 | $SSH "cd ~/juju-meta/ && swift --os-auth-url $OS_AUTH_URL --os-username $OS_USERNAME \ | ||
189 | 114 | --os-password $OS_PASSWORD --os-tenant-name $OS_TENANT_NAME \ | ||
190 | 115 | upload juju-meta images" | ||
191 | 116 | $SSH "cd ~/juju-meta/ && swift --os-auth-url $OS_AUTH_URL --os-username $OS_USERNAME \ | ||
192 | 117 | --os-password $OS_PASSWORD --os-tenant-name $OS_TENANT_NAME \ | ||
193 | 118 | upload juju-meta tools" | ||
194 | 119 | |||
195 | 120 | $SSH swift --os-auth-url $OS_AUTH_URL --os-username $OS_USERNAME --os-password $OS_PASSWORD \ | ||
196 | 121 | --os-tenant-name $OS_TENANT_NAME post -r '.r:*' juju-meta | ||
197 | 122 | |||
198 | 123 | ## collect the URL for getting the images | ||
199 | 124 | $($SSH swift --os-auth-url $OS_AUTH_URL --os-username $OS_USERNAME --os-password $OS_PASSWORD \ | ||
200 | 125 | --os-tenant-name $OS_TENANT_NAME auth) | ||
201 | 126 | |||
202 | 127 | ### | ||
203 | 128 | ###juju bootstrap openstack openstack --config image-metadata-url=http://192.168.16.5/juju/images/ --config network=private --upload-tools --debug -v | ||
204 | 129 | ### | ||
205 | 130 | |||
206 | 131 | my_ip=`ip route | grep src| grep -v virb|grep -v lxcb| head -1| cut -d " " -f 12 ` | ||
207 | 76 | #Bootstrap Juju | 132 | #Bootstrap Juju |
215 | 77 | ssh -o StrictHostKeyChecking=no ubuntu@$FLOAT_IP "juju bootstrap --metadata-source=/home/ubuntu --upload-tools=true --series=precise,trusty" | 133 | ##$SSH "juju bootstrap openstack openstack --metadata-source=/var/www/html/juju-meta/ --upload-tools" |
216 | 78 | 134 | $SSH "juju bootstrap openstack openstack --config image-metadata-url=$OS_STORAGE_URL/juju-meta/images/ --config tools-metadata-url=$OS_STORAGE_URL/juju-meta/tools/ --config network=private" | |
217 | 79 | #Deploy juju-gui | 135 | |
218 | 80 | ssh -o StrictHostKeyChecking=no ubuntu@$FLOAT_IP "juju deploy --to 0 juju-gui && juju expose juju-gui" | 136 | |
212 | 81 | |||
213 | 82 | #Install the Orange-box-examples package | ||
214 | 83 | ssh -o StrictHostKeyChecking=no ubuntu@$FLOAT_IP "sudo apt-add-repository ppa:orange-box-examples/ppa && sudo apt-get update && sudo apt-get install -y orange-box-examples" | ||
219 | 84 | 137 | ||
220 | 85 | ## useless if juju floating ip option on. | 138 | ## useless if juju floating ip option on. |
221 | 86 | ######################################### | 139 | ######################################### |
222 | @@ -93,7 +146,9 @@ | |||
223 | 93 | echo "Now connect to the Juju-GUI at: http://$FLOAT_IP2/ to continue deployments on Openstack." | 146 | echo "Now connect to the Juju-GUI at: http://$FLOAT_IP2/ to continue deployments on Openstack." |
224 | 94 | echo "Pass: $OS_PASSWORD" | 147 | echo "Pass: $OS_PASSWORD" |
225 | 95 | 148 | ||
227 | 96 | echo "OR Log in to openstack Jumpserver to deploy from command line" | 149 | echo "OR Log in to openstack Jumpserver2 to deploy from command line" |
228 | 97 | echo "ssh ubuntu@$FLOAT_IP" | 150 | echo "ssh ubuntu@$FLOAT_IP" |
229 | 151 | echo " You must set the following if creating a new model:" | ||
230 | 152 | echo " juju set-model-config image-metadata-url=$OS_STORAGE_URL/juju-meta/images/ tools-metadata-url=$OS_STORAGE_URL/juju-meta/tools/ network=private" | ||
231 | 98 | exit | 153 | exit |
232 | 99 | 154 | ||
233 | 100 | 155 | ||
234 | === modified file 'openstack/get-cloud-images' | |||
235 | --- openstack/get-cloud-images 2016-01-31 11:07:43 +0000 | |||
236 | +++ openstack/get-cloud-images 2016-06-17 14:41:49 +0000 | |||
237 | @@ -2,11 +2,12 @@ | |||
238 | 2 | 2 | ||
239 | 3 | 3 | ||
240 | 4 | 4 | ||
242 | 5 | folder=/srv/data | 5 | folder=/srv/data/ |
243 | 6 | URLS="http://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64-disk1.img \ | 6 | URLS="http://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64-disk1.img \ |
244 | 7 | http://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img \ | 7 | http://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img \ |
246 | 8 | http://cloud-images.ubuntu.com/wily/current/wily-server-cloudimg-amd64-disk1.img \ | 8 | http://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img \ |
247 | 9 | http://mirror.catn.com/pub/catn/images/qcow2/centos6.4-x86_64-gold-master.img \ | 9 | http://mirror.catn.com/pub/catn/images/qcow2/centos6.4-x86_64-gold-master.img \ |
248 | 10 | http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2 \ | ||
249 | 10 | http://download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-disk.img " | 11 | http://download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-disk.img " |
250 | 11 | 12 | ||
251 | 12 | for URL in $URLS | 13 | for URL in $URLS |
252 | @@ -16,9 +17,9 @@ | |||
253 | 16 | then | 17 | then |
254 | 17 | echo "$FILENAME already downloaded." | 18 | echo "$FILENAME already downloaded." |
255 | 18 | else | 19 | else |
257 | 19 | wget -q -O $folder/$FILENAME $URL | 20 | wget -O $folder/$FILENAME $URL |
258 | 20 | fi | 21 | fi |
259 | 21 | done | 22 | done |
260 | 22 | 23 | ||
261 | 23 | 24 | ||
263 | 24 | echo "To download Windows image get there : http://www.cloudbase.it/cloud-init-for-windows-instances/" | 25 | echo "To download Windows image get there : https://cloudbase.it/windows-cloud-images/" |
264 | 25 | 26 | ||
265 | === modified file 'openstack/orange-box-configure-openstack' | |||
266 | --- openstack/orange-box-configure-openstack 2015-10-09 18:44:36 +0000 | |||
267 | +++ openstack/orange-box-configure-openstack 2016-06-17 14:41:49 +0000 | |||
268 | @@ -3,7 +3,7 @@ | |||
269 | 3 | # orange-box-configure-openstack | 3 | # orange-box-configure-openstack |
270 | 4 | # Copyright (C) 2014 Canonical Ltd. | 4 | # Copyright (C) 2014 Canonical Ltd. |
271 | 5 | # | 5 | # |
273 | 6 | # Authors: Darryl Weaver <darryl.weaver@canonical.com> | 6 | # Authors: Nicolas Thomss <nicolas.thomas@canonical.com> |
274 | 7 | # | 7 | # |
275 | 8 | # This program is free software: you can redistribute it and/or modify | 8 | # This program is free software: you can redistribute it and/or modify |
276 | 9 | # it under the terms of the GNU General Public License as published by | 9 | # it under the terms of the GNU General Public License as published by |
277 | @@ -21,74 +21,155 @@ | |||
278 | 21 | 21 | ||
279 | 22 | echo "This command is run to configure an Orange-Box Openstack deployment" | 22 | echo "This command is run to configure an Orange-Box Openstack deployment" |
280 | 23 | 23 | ||
295 | 24 | PKGS=" python-keystone python-neutronclient python-novaclient python-glanceclient" | 24 | ## This is the only OB specific section: |
296 | 25 | dpkg -l $PKGS > /dev/null || sudo apt-get install -y $PKGS | 25 | obnum=$(hostname | cut -c 10- -) |
297 | 26 | 26 | external_net=$((obnum+1)) | |
298 | 27 | NEUTRON_EXT_NET_GW="10.14.4.1" | 27 | |
299 | 28 | NEUTRON_EXT_NET_CIDR="10.14.0.0/16" | 28 | NEUTRON_EXT_NET_GW="172.27.${external_net}.254" |
300 | 29 | NEUTRON_EXT_NET_NAME="ext_net" | 29 | NEUTRON_EXT_NET_CIDR="172.27.${external_net}.0/23" |
301 | 30 | NEUTRON_DNS="10.14.4.1" | 30 | |
302 | 31 | NEUTRON_FLOAT_RANGE_START="10.14.200.1" | 31 | NEUTRON_EXT_NET_NAME="ext_net" # Unused |
303 | 32 | NEUTRON_FLOAT_RANGE_END="10.14.249.254" | 32 | NEUTRON_DNS="172.27.$((obnum)).1" |
304 | 33 | 33 | NEUTRON_FLOAT_RANGE_START="172.27.${external_net}.151" | |
305 | 34 | NEUTRON_FIXED_NET_CIDR="192.168.14.0/24" | 34 | NEUTRON_FLOAT_RANGE_END="172.27.${external_net}.252" |
306 | 35 | NEUTRON_FIXED_NET_NAME="admin_net" | 35 | |
307 | 36 | 36 | NEUTRON_FIXED_NET_CIDR="192.168.16.0/22" | |
308 | 37 | keystone=$(juju status keystone | grep public-address | head -1 | awk '{print $2}') | 37 | #NEUTRON_FIXED_NET_NAME="admin_net" # Unused |
309 | 38 | |||
310 | 39 | #Check if VIP is set on keystone | ||
311 | 40 | keystone_VIP=`juju get-config keystone| python -c "import yaml; import sys; print yaml.load(sys.stdin)[\"settings\"][\"vip\"][\"value\"]"||true` | ||
312 | 41 | |||
313 | 42 | if [ -n "$keystone_VIP" ] | ||
314 | 43 | then | ||
315 | 44 | keystone=$keystone_VIP | ||
316 | 45 | else | ||
317 | 46 | #if os-public-hostname is set and not VIP assume we need to use those at OpenStack endpoints. | ||
318 | 47 | keystone_PUBENDPOINT=`juju get-config keystone| python -c "import yaml; import sys; print yaml.load(sys.stdin)[\"settings\"][\"os-public-hostname\"][\"value\"]"||true` | ||
319 | 48 | if [ -n "$keystone_PUBENDPOINT" ] | ||
320 | 49 | then | ||
321 | 50 | ## will need to add the PUBENPOINT to the different services interfaces to enable access on ob-num+2 network. | ||
322 | 51 | ## Assume a fresh install where the unit ID is 0 keystone/0 for example (TO BE FIXED) | ||
323 | 52 | unset DEVICE | ||
324 | 53 | for service in keystone cinder glance neutron-api nova-cloud-controller ceph-radosgw | ||
325 | 54 | do | ||
326 | 55 | DEVICE=`juju ssh ${service}/0 "ip route" | grep 172.27.$((obnum+2)). |head -1 | awk '{ print $3}'` | ||
327 | 56 | # assuming the os-public-name are IPs not names will fail if not set | ||
328 | 57 | OSPUBLICIP=`juju get-config ${service}| python -c "import yaml; import sys; print yaml.load(sys.stdin)[\"settings\"][\"os-public-hostname\"][\"value\"]"||true` | ||
329 | 58 | [ -n "$OSPUBLICIP" ] && juju ssh ${service}/0 "sudo ifconfig $DEVICE:1 $OSPUBLICIP" | ||
330 | 59 | done | ||
331 | 60 | keystone=$keystone_PUBENDPOINT | ||
332 | 61 | else | ||
333 | 62 | keystone=$(juju status keystone --format=yaml | grep public-address | head -1 | awk '{print $2}') | ||
334 | 63 | fi | ||
335 | 64 | fi | ||
336 | 65 | |||
337 | 38 | 66 | ||
338 | 39 | echo "export SERVICE_ENDPOINT=http://$keystone:35357/v2.0/ | 67 | echo "export SERVICE_ENDPOINT=http://$keystone:35357/v2.0/ |
340 | 40 | export SERVICE_TOKEN=admin | 68 | unset SERVICE_TOKEN |
341 | 69 | unset SERVICE_ENDPOINT | ||
342 | 41 | export OS_AUTH_URL=http://$keystone:35357/v2.0/ | 70 | export OS_AUTH_URL=http://$keystone:35357/v2.0/ |
345 | 42 | export OS_USERNAME=admin | 71 | export OS_USERNAME=$(juju get-config keystone | python -c "import yaml; import sys; print yaml.load(sys.stdin)[\"settings\"][\"admin-user\"][\"value\"]") |
346 | 43 | export OS_PASSWORD=admin | 72 | export OS_PASSWORD=$(juju get-config keystone | python -c "import yaml; import sys; print yaml.load(sys.stdin)[\"settings\"][\"admin-password\"][\"value\"]") |
347 | 44 | export OS_TENANT_NAME=admin | 73 | export OS_TENANT_NAME=admin |
349 | 45 | export OS_REGION_NAME=RegionOne | 74 | export OS_REGION_NAME=$(juju get-config keystone | python -c "import yaml; import sys; print yaml.load(sys.stdin)[\"settings\"][\"region\"][\"value\"]") |
350 | 46 | " > ~/nova.rc | 75 | " > ~/nova.rc |
351 | 47 | 76 | ||
353 | 48 | . ~/nova.rc | 77 | source ~/nova.rc |
354 | 49 | 78 | ||
355 | 50 | # Determine the tenant id for the configured tenant name. | 79 | # Determine the tenant id for the configured tenant name. |
356 | 51 | export TENANT_ID="$(keystone tenant-list | grep $OS_TENANT_NAME | awk '{ print $2 }')" | 80 | export TENANT_ID="$(keystone tenant-list | grep $OS_TENANT_NAME | awk '{ print $2 }')" |
357 | 52 | 81 | ||
358 | 82 | if [ "$TENANT_ID" = "" ]; then | ||
359 | 83 | echo "Unable to find tenant ID, keystone auth problem" | ||
360 | 84 | exit | ||
361 | 85 | fi | ||
362 | 86 | |||
363 | 87 | echo "Configuring Openstack Neutron Networking" | ||
364 | 88 | |||
365 | 53 | #create ext network with neutron for floating IPs | 89 | #create ext network with neutron for floating IPs |
368 | 54 | EXTERNAL_NETWORK_ID=$(neutron net-create ext_net --tenant-id $TENANT_ID -- --router:external=True | grep " id" | awk '{print $4}') | 90 | neutron net-show ext_net > /dev/null 2>&1 || neutron net-create ext_net --tenant-id $TENANT_ID -- --router:external=True |
369 | 55 | neutron subnet-create ext_net $NEUTRON_EXT_NET_CIDR --name ext_net_subnet --tenant-id $TENANT_ID \ | 91 | EXTERNAL_NETWORK_ID=$(neutron net-show ext_net | grep " id" | awk '{print $4}') |
370 | 92 | 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 \ | ||
371 | 56 | --allocation-pool start=$NEUTRON_FLOAT_RANGE_START,end=$NEUTRON_FLOAT_RANGE_END \ | 93 | --allocation-pool start=$NEUTRON_FLOAT_RANGE_START,end=$NEUTRON_FLOAT_RANGE_END \ |
372 | 57 | --gateway $NEUTRON_EXT_NET_GW --disable-dhcp --dns_nameservers $NEUTRON_DNS list=true | 94 | --gateway $NEUTRON_EXT_NET_GW --disable-dhcp --dns_nameservers $NEUTRON_DNS list=true |
373 | 58 | 95 | ||
374 | 59 | #Create private network for neutron for tenant VMs | 96 | #Create private network for neutron for tenant VMs |
377 | 60 | neutron net-create private | 97 | neutron net-show private > /dev/null 2>&1 || neutron net-create private |
378 | 61 | SUBNET_ID=$(neutron subnet-create private $NEUTRON_FIXED_NET_CIDR -- --name private_subnet --dns_nameservers list=true $NEUTRON_DNS | grep " id" | awk '{print $4}') | 98 | 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 |
379 | 99 | SUBNET_ID=$(neutron subnet-show private_subnet | grep " id" | awk '{print $4}') | ||
380 | 62 | 100 | ||
381 | 63 | #Create router for external network and private network | 101 | #Create router for external network and private network |
384 | 64 | ROUTER_ID=$(neutron router-create --tenant-id $TENANT_ID provider-router | grep " id" | awk '{print $4}') | 102 | neutron router-show provider-router > /dev/null 2>&1 || neutron router-create --tenant-id $TENANT_ID provider-router |
385 | 65 | neutron router-interface-add $ROUTER_ID $SUBNET_ID | 103 | ROUTER_ID=$(neutron router-show provider-router | grep " id" | awk '{print $4}') |
386 | 104 | |||
387 | 105 | neutron router-gateway-clear provider-router || true | ||
388 | 66 | neutron router-gateway-set $ROUTER_ID $EXTERNAL_NETWORK_ID | 106 | neutron router-gateway-set $ROUTER_ID $EXTERNAL_NETWORK_ID |
389 | 107 | ## make it always ok to have it indempodent. | ||
390 | 108 | neutron router-interface-add $ROUTER_ID $SUBNET_ID || true | ||
391 | 109 | |||
392 | 110 | |||
393 | 111 | echo "Configuring security groups for access to ICMP, SSH and RDP by default" | ||
394 | 67 | 112 | ||
395 | 68 | #Configure the default security group to allow ICMP and SSH | 113 | #Configure the default security group to allow ICMP and SSH |
398 | 69 | nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0 | 114 | 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 |
399 | 70 | nova secgroup-add-rule default tcp 22 22 0.0.0.0/0 | 115 | 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 |
400 | 71 | #for rdp | 116 | #for rdp |
402 | 72 | nova secgroup-add-rule default tcp 3389 3389 0.0.0.0/0 | 117 | 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 |
403 | 118 | |||
404 | 119 | |||
405 | 120 | |||
406 | 121 | echo "Uploading default SSH key" | ||
407 | 73 | 122 | ||
408 | 74 | #Upload a default SSH key | 123 | #Upload a default SSH key |
414 | 75 | nova keypair-add --pub-key ~/.ssh/id_rsa.pub default | 124 | nova keypair-list | grep default > /dev/null 2>&1 || nova keypair-add --pub-key ~/.ssh/id_rsa.pub default > /dev/null 2>&1 |
415 | 76 | 125 | ||
416 | 77 | #Remove the m1.tiny as it is too small for Ubuntu. | 126 | echo "Modifying the flavors to be better sized for the Orange Box" |
417 | 78 | nova flavor-delete m1.tiny | 127 | |
418 | 79 | nova flavor-delete m1.xlarge | 128 | #Modify the flavours to fit better on the OB |
419 | 129 | #nova flavor-create FLAVOR_NAME FLAVOR_ID RAM_IN_MB ROOT_DISK_IN_GB NUMBER_OF_VCPUS | ||
420 | 130 | nova flavor-delete m1.tiny > /dev/null 2>&1 | ||
421 | 131 | nova flavor-delete m1.small > /dev/null 2>&1 | ||
422 | 132 | nova flavor-delete m1.medium > /dev/null 2>&1 | ||
423 | 133 | nova flavor-delete m1.large > /dev/null 2>&1 | ||
424 | 134 | nova flavor-delete m1.xlarge > /dev/null 2>&1 | ||
425 | 135 | nova flavor-create --is-public true m1.tiny auto 512 5 1 > /dev/null 2>&1 | ||
426 | 136 | nova flavor-create --is-public true m1.small auto 1024 10 1 > /dev/null 2>&1 | ||
427 | 137 | nova flavor-create --is-public true m1.medium auto 2048 10 2 > /dev/null 2>&1 | ||
428 | 138 | nova flavor-create --is-public true m1.large auto 3072 10 2 > /dev/null 2>&1 | ||
429 | 139 | ## need extra for windows image (15g) | ||
430 | 140 | nova flavor-create --is-public true m1.xlarge auto 8096 30 4 > /dev/null 2>&1 | ||
431 | 141 | |||
432 | 142 | echo "modifying default quotas for admin user" | ||
433 | 80 | 143 | ||
434 | 81 | #Modify quotas for the tenant to allow large deployments | 144 | #Modify quotas for the tenant to allow large deployments |
439 | 82 | nova quota-update --instances 100 $TENANT_ID | 145 | nova quota-update --instances 400 $TENANT_ID |
440 | 83 | nova quota-update --cores 200 $TENANT_ID | 146 | nova quota-update --cores 800 $TENANT_ID |
441 | 84 | nova quota-update --ram 204800 $TENANT_ID | 147 | nova quota-update --ram 404800 $TENANT_ID |
442 | 85 | nova quota-update --security-groups 200 $TENANT_ID | 148 | nova quota-update --security-groups 4000 $TENANT_ID |
443 | 149 | nova quota-update --floating_ips -1 $TENANT_ID | ||
444 | 150 | nova quota-update --security-group-rules -1 $TENANT_ID | ||
445 | 151 | |||
446 | 152 | ### need to find how to change quota for the project not the tenant | ||
447 | 153 | |||
448 | 154 | ### modify default quota the same way.. | ||
449 | 155 | nova quota-class-update --instances 400 $TENANT_ID | ||
450 | 156 | nova quota-class-update --cores 800 $TENANT_ID | ||
451 | 157 | nova quota-class-update --ram 404800 $TENANT_ID | ||
452 | 158 | nova quota-class-update --security-groups 4000 $TENANT_ID | ||
453 | 159 | nova quota-class-update --floating_ips -1 $TENANT_ID | ||
454 | 160 | nova quota-class-update --security-group-rules -1 $TENANT_ID | ||
455 | 161 | |||
456 | 162 | echo "Uploading images to glance" | ||
457 | 86 | 163 | ||
458 | 87 | #Upload images to glance | 164 | #Upload images to glance |
464 | 88 | glance add name="Precise x86_64" is_public=true container_format=ovf disk_format=qcow2 < /srv/data/precise-server-cloudimg-amd64-disk1.img | 165 | glance image-show "Precise x86_64" > /dev/null 2>&1 || glance image-create --name="Precise x86_64" --is-public=true --container-format=ovf --disk-format=qcow2 < /srv/data/precise-server-cloudimg-amd64-disk1.img |
465 | 89 | glance add name="Trusty x86_64" is_public=true container_format=ovf disk_format=qcow2 < /srv/data/trusty-server-cloudimg-amd64-disk1.img | 166 | 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 |
466 | 90 | #glance add name="CentOS 6.4" is_public=true container_format=bare disk_format=qcow2 < /srv/data/centos6.4-x86_64-gold-master.img | 167 | 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 |
467 | 91 | #glance add name="Cirros 0.3" is_public=true container_format=bare disk_format=qcow2 < /srv/data/cirros-0.3.2-x86_64-disk.img | 168 | |
468 | 92 | ##glance add name="Windows Server 2012" is_public=true container_format=bare disk_format=qcow2 < /srv/data/windows_server_2012_r2_standard_eval_kvm_20140607.qcow2 & | 169 | 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 |
469 | 170 | 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 | ||
470 | 171 | ## image name is used by script to generate metadata .. don't screw the series | ||
471 | 172 | 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 | ||
472 | 173 | |||
473 | 93 | 174 | ||
474 | 94 | exit | 175 | exit |
Noticed one thing on a quick overview:
openstack/ 01-deploy. sh:
+juju set-model-config cloudimg-base-url=http:// 172.27. 60.1/mirrors/ cloud-images. ubuntu. com/query
31
^static IP, I'm guessing you have OB60?
Note: for grabbing the cloud images from /srv/, definitely the way to go but would be nice to have a checksum check to ensure they were all downloaded properly the first time although testing one's setup would reveal this problem also.