-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrdo-packstack.yaml
More file actions
631 lines (494 loc) · 19.6 KB
/
Copy pathrdo-packstack.yaml
File metadata and controls
631 lines (494 loc) · 19.6 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
---
# Fire up a OpenStack instance in EC2 using RDO and packstack.
#
# Use the devstack vars file to set things
#
# See
#
# http://openstack.redhat.com/Quickstart
#
# and then for quantum
#
# https://fedoraproject.org/wiki/Packstack_to_Quantum
#
# INSTANCES
#
# This section fires up a set of guests dynamically,
# registering them in the inventory under a relevant group
#
- hosts:
- localhost
connection: local
gather_facts: False
vars_files:
- iaas/vars/ec2-vars.yaml
- packstack/vars/packstack-vars.yaml
tasks:
- name: Fire up a node in EC2
action: ec2
keypair=${ec2_keypair}
id=${run_ID}
instance_type=${ec2_type}
image=${ec2_image}
wait=true
group=${ec2_sec_group}
register: ec2
tags:
- quantum
- images
- tempest
- wip
- name: Capture the EC2 instance's contact info into the inventory
action: add_host
hostname='${item.public_dns_name}'
ansible_ssh_host='${item.public_ip}'
groupname=rdo
with_items: ${ec2.instances}
tags:
- quantum
- images
- tempest
- wip
#
# Dump data on these hosts.
#
- hosts: rdo
vars_files:
- iaas/vars/ec2-vars.yaml
- packstack/vars/packstack-vars.yaml
user: '${remote_user}'
sudo: False
gather_facts: True
tags:
- wip
- quantum
- tempest
tasks:
- name: ec2 facts
action: ec2_facts
register: ec2_facts
- name: dump everything
local_action: template src=common/templates/dump.j2 dest=./ansible_data_dump.txt
#
# Add storage if not present
#
- hosts: rdo
vars_files:
- iaas/vars/ec2-vars.yaml
- packstack/vars/packstack-vars.yaml
user: '${remote_user}'
sudo: False
gather_facts: True
tasks:
- name: ec2 facts
action: ec2_facts
register: ec2_facts
- name: Create volumes and attach ...
local_action: ec2_vol instance=${ansible_ec2_instance_id} volume_size=${cinder_volume_size}
when: ansible_devices.xvdj is not defined
register: ec2_volumes
#******************************
#*
#* BUILD IT
#*
#******************************
- hosts: rdo
vars_files:
- iaas/vars/ec2-vars.yaml
- packstack/vars/packstack-vars.yaml
user: '${remote_user}'
sudo: True
gather_facts: True
tasks:
- name: ec2 facts
action: ec2_facts
register: ec2_facts
tags:
- wip
- quantum
- name: dump everything
action: template src=common/templates/dump.j2 dest=/tmp/ec2_data_dump.txt
tags: wip
#---------------------------------
# Bootstrap needed packages first,
# setup volumes etc., and
# let me run as sudo
#---------------------------------
- name: let me run as sudo
action: template src=packstack/templates/sudoers-remote-user
dest=/etc/sudoers.d/cloud-init
owner=root group=root mode=0644
- name: avoid an update to cloud-init that might break access
action: lineinfile dest=/etc/yum.conf
regexp="^exclude=cloud-init"
state=present
create=yes
line="exclude=cloud-init kernel"
- name: upgrade lots of packages
action: shell yum -y upgrade
- name: install some basic packages
action: yum name=${item} state=present
with_items:
- git
- which
- bind-utils
- tar
- gzip
- lvm2
- screen
- emacs-nox
- telnet
- rsync
- gcc
# - name: relocate /var/lib/ to ephemeral storage
# action: shell rsync -a /var/lib /media/ephemeral0/lib && mv /var/lib /var/lib.old && ln -s /media/ephemeral0/lib /var/lib
- name: setup ssh keys for root
action: shell cd /root/.ssh && rm -f id_rsa* && ssh-keygen -f id_rsa -t rsa -N '' && cat id_rsa.pub >> authorized_keys
- name: setup ephemeral storage for OpenStack activities
action: file path=${data_store_dir} owner=root group=root state=directory
- name: link to ephemeral storage
action: file src=${data_store_dir} dest=/tmp/openstack owner=root group=root state=link
#
# Setup a volume group from the EBS volume we mounted
#
- name: setup a volume group for Cinder
action: lvg pvs=/dev/${cinder_volume_dev} vg=${cinder_vg_name} state=present
ignore_errors: yes
#--------------------------------------------------------------------------------------------------
# Build basic all-in-one OpenStack
# instance using packstack & RDO
#--------------------------------------------------------------------------------------------------
- name: install the RDO repos
action: shell yum install -y ${repo_rpm}
ignore_errors: yes
- name: install packstack and utils
action: yum name=${item} state=present
with_items:
- openstack-packstack
- openstack-utils
- name: packstack patch
action: copy src=packstack/files/swift_common.pp
dest=/usr/lib/python2.6/site-packages/packstack/puppet/templates/swift_common.pp
owner=root group=root mode=644 backup=yes
# - name: create a packstack answer file, if not already present
# action: shell [ -f /tmp/answers.txt ] || packstack --gen-answer-file=/tmp/answers.txt
# tags: wip
- name: push a script to setup an answers file
action: template src=packstack/templates/setup-answers-file.sh
dest=/tmp/openstack/setup-answers-file.sh
owner=${remote_user} group=${remote_user} mode=0775
- name: create the answers file
action: shell /tmp/openstack/setup-answers-file.sh
- name: setup state dirs for OpenStack activities
action: file path=${data_store_dir}/lib/${item} owner=root group=root state=directory
with_items:
- nova
- glance
- cinder
- name: link to ephemeral state storage
action: file src=${data_store_dir}/lib/${item} dest=/var/lib/${item} owner=root group=root state=link
with_items:
- nova
- glance
- cinder
- name: run packstack
action: shell [ -f /tmp/openstack/packstack ] || touch /tmp/openstack/packstack && packstack --answer-file=/tmp/openstack/answers.txt
- name: setup credentials for keystone
action: lineinfile dest=/root/.bashrc
regexp="^source /root/keystonerc_admin"
state=present
create=yes
line="source /root/keystonerc_admin"
- name: restart after this change
action: service name=${item} state=restarted
with_items:
- openstack-nova-api
- openstack-nova-cert
- openstack-nova-conductor
- openstack-nova-console
- openstack-nova-consoleauth
- openstack-nova-novncproxy
- openstack-nova-scheduler
- openstack-nova-compute
# - name: bail
# action: shell exit 1
#--------------------------------------------------------------------------------------------------
# Swap out nova-network for quantum
#--------------------------------------------------------------------------------------------------
# 1. Terminate nova networking
- name: stop nova-network daemons
action: service name=openstack-nova-network state=stopped
tags: quantum
# 2. Install quantum service
- name: install quantum packages
action: yum name=openstack-quantum state=present
tags: quantum
# 3. Install OpenvSwitch plugin
- name: install openvswitch plugin for quantum
action: yum name=openstack-quantum-openvswitch state=present
tags: quantum
# 4. The Quantum installation scripts make use of keystone environment variables.
# Make sure that the administrator environment variables are set.
# 5. Configure quantum service
#
- name: push a script to wrap these scripts
action: template src=packstack/templates/quantum-setup.sh
dest=/tmp/openstack/quantum-setup.sh
owner=${remote_user} group=${remote_user} mode=0775
tags: quantum
- name: setup quantum using default scripts
action: shell /tmp/openstack/quantum-setup.sh server
tags: quantum
- name: fix the quantum config for running sudo jobs
action: shell openstack-config
--set /etc/quantum/quantum.conf
DEFAULT
root_helper
"sudo quantum-rootwrap /etc/quantum/rootwrap.conf"
tags: quantum
- name: configure security groups
action: shell openstack-config
--set /etc/quantum/quantum.conf
SECURITYGROUP
firewall_driver
quantum.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
tags: quantum
# 6.1. The above script will ask if the nova parameters need to be updated.
# Restart the nova compute service. The script will configure Quantum as the networking module for Nova.
- name: restart nova-compute daemons
action: service name=openstack-nova-compute state=restarted
tags: quantum
# 6.2 Start the openvswitch service
- name: start openvswitch daemons
action: service name=openvswitch state=started
tags: quantum
# 6.3 Create the integration bridge (for the private network)
- name: create internal bridge
action: shell ovs-vsctl add-br br-int
ignore_errors: yes
tags: quantum
# 6.4 Create the external bridge (for the layer 3 agent)
- name: stop nova-network daemons
action: shell ovs-vsctl add-br br-ex
ignore_errors: yes
tags: quantum
# 6.5 Ensure that the interfaces are persistant after reboot. This is done by creating interface files, for example for br-int:
- name: setup interface for this internal bridge
action: copy src=packstack/files/ifcfg-br-int
dest=/etc/sysconfig/network-scripts/ifcfg-br-int
owner=root group=root mode=644
tags: quantum
- name: setup interface for this external bridge
action: copy src=packstack/files/ifcfg-br-ex
dest=/etc/sysconfig/network-scripts/ifcfg-br-ex
owner=root group=root mode=644
tags: quantum
# 7. Start quantum service
- name: start quantum
action: service name=quantum-server state=restarted
tags: quantum
# 7.1 Start quantum agent
- name: start quantum agent
action: service name=quantum-openvswitch-agent state=restarted
tags: quantum
# 8. In order for the IPAM to take place one needs to invoke the DHCP agent. Use the DHCP setup tool
- name: setup dhcp for quantum
action: shell /tmp/openstack/quantum-setup.sh dhcp
tags: quantum
# 8.1. Start DHCP agent
- name: start quantum dhcp
action: service name=quantum-dhcp-agent state=restarted
tags: quantum
# 9. In order to support floating IP's one need to invoke the Layer 3 agent. Use the L3 agent setup tool
- name: setup l3 for quantum,
action: shell /tmp/openstack/quantum-setup.sh l3
tags: quantum
#9.1. Start the L3 agent
- name: start quantum l3
action: service name=quantum-l3-agent state=restarted
tags: quantum
# 10. Ensure that the openvswitch cleanup utility is enabled (this is used
# after reboot to ensure that device management of the quantum agents is not affected
# by the fact that the openvswitch creates the interfaces at boot)
- name: start quantum cleanup script
action: service name=quantum-ovs-cleanup state=started
tags: quantum
# Setup some quantum services and objects
- name: push a script for a quantum reqistration in keystone
action: template src=packstack/templates/quantum-registration-script.sh
dest=/tmp/openstack/quantum-registration-script.sh
owner=${remote_user} group=${remote_user} mode=0775
tags: quantum
- name: setup quantum registry entries
action: shell /tmp/openstack/quantum-registration-script.sh
tags: quantum
- name: restart quantum-relevant services
action: service name=${item} state=restarted
with_items:
- openstack-nova-conductor
- openstack-nova-api
- openstack-keystone
- openstack-nova-compute
- httpd
tags: quantum
- name: push a script to setup some basic quantum network objects for the admin user/tenant
action: template src=packstack/templates/setup-admin-resources.sh
dest=/tmp/openstack/setup-admin-resources.sh
owner=${remote_user} group=${remote_user} mode=0775
tags: quantum
- name: setup quantum objects for admin user
action: shell . /root/keystonerc_admin && /tmp/openstack/setup-admin-resources.sh
tags: quantum
- name: last step -- see if nove compute successfully restarted, and if not get it running
action: shell sleep 2 && /etc/init.d/openstack-nova-compute restart
tags: quantum
#--------------------------------------------------------------------------------------------------
#
# Run a script to create a test user
#
#--------------------------------------------------------------------------------------------------
- name: push a script for creating a test user and group setup
action: template src=packstack/templates/test-setup.sh
dest=/tmp/openstack/test-setup.sh
owner=${remote_user} group=${remote_user} mode=0775
tags: quantum
- name: run test script
action: shell . /root/keystonerc_admin && /tmp/openstack/test-setup.sh
tags: quantum
#--------------------------------------------------------------------------------------------------
#
# Load some images
#
#--------------------------------------------------------------------------------------------------
- name: push a script for upload VM images
action: copy src=common/files/upload-image.sh
dest=/tmp/openstack/upload-image.sh
owner=root group=root mode=755
tags: images
- name: push some images ...
action: shell . /root/keystonerc_admin && /tmp/openstack/upload-image.sh ${item}
with_items:
- http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-uec.tar.gz
- http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-disk.img
- http://smoser.brickies.net/ubuntu/ttylinux-uec/ttylinux-uec-amd64-11.2_2.6.35-15_1.tar.gz
- http://cloud-images.ubuntu.com/quantal/current/quantal-server-cloudimg-amd64-disk1.img
- http://mattdm.fedorapeople.org/cloud-images/Fedora18-Cloud-x86_64-latest.qcow2
tags: images
#--------------------------------------------------------------------------------------------------
#
# Setup Ceilometer
#
#--------------------------------------------------------------------------------------------------
#
# Fix for ceilometer: install mondodb
#
- name: install mongodb (a fix)
action: yum name=mongodb-server state=present
- name: install ceilometer pkgs
action: yum name=${item} state=present
with_items:
- openstack-ceilometer-api
- openstack-ceilometer-central
- openstack-ceilometer-collector
- openstack-ceilometer-common
- openstack-ceilometer-compute
- python-ceilometer
- python-ceilometerclient
- python-ceilometerclient-doc
tags:
- ceilometer
# - name:
#--------------------------------------------------------------------------------------------------
#
# Install & Configure Heat
#
#--------------------------------------------------------------------------------------------------
- name: install heat pkgs
action: yum name=${item} state=present
with_items:
- openstack-heat-api
- openstack-heat-api-cfn
- openstack-heat-api-cloudwatch
- openstack-heat-cli
- openstack-heat-common
- openstack-heat-engine
- python-heatclient
- python-heatclient-doc
tags:
- ceilometer
#Configure the Heat database
#
# sudo heat-db-setup rpm
# Configure Keystone
# source ~/keystonerc
# wget https://raw.github.com/heat-api/heat/master/tools/heat-keystone-service
# chmod +x heat-keystone-service
# sudo -E ./heat-keystone-service
#Create a special flavor
# nova flavor-create --ephemeral 10 --swap 0 --rxtx-factor 1 m2.xlarge 7 512 0 1
#Workaround RHBZ #860282
# cd /lib/systemd/system
# for f in heat*.service; do sudo sed -i "s/^User=heat/User=openstack-heat/" $f; done
# Start Heat services
# for svc in heat-api-cfn heat-api-cloudwatch heat-engine heat-metadata; do sudo systemctl start $svc.service; done
#Download JEOS:
# wget https://github.com/downloads/heat-api/prebuilt-jeos-images/F17-x86_64-cfntools.qcow2
# Register JEOS with glance:
# sudo mv F17-x86_64-cfntools.qcow2 /var/lib/libvirt/images
# glance add name=F17-x86_64-cfntools is_public=true disk_format=qcow2 container_format=bare < /var/lib/libvirt/images/F17-x86_64-cfntools.qcow2
#--------------------------------------------------------------------------------------------------
#
# Run Tests
#
#--------------------------------------------------------------------------------------------------
- name: pull tempest code
git: repo=git://github.com/openstack/tempest.git dest=/tmp/openstack/tempest version=stable/grizzly
tags: tempest
- name: install python yum modules needed to test
action: yum name=${item} state=present
with_items:
- python-testtools
- python-pip
- gcc
- openssl-devel
- python-virtualenv
tags: tempest
# - name: install python modules via pip needed to test
# action: pip name=testresources state=present
# tags: wip
- name: install python modules via pip needed to test
action: shell pip-python install --update ${item}
with_items:
- nose
- testtools
- testresources
tags: tempest
- name: copy over a script to setup the tests
action: template src=packstack/templates/setup-tempest.sh
dest=/tmp/openstack/setup-tempest.sh
owner=root group=root mode=755
tags: tempest
- name: setup the tests
action: shell . /root/keystonerc_admin && /tmp/openstack/setup-tempest.sh
tags: tempest
- name: run some identity tests
action: shell cd /tmp/openstack/tempest && ./run_tests.sh -V -- "-w tempest/tests/identity"
tags: tempest
- name: run some image tests
action: shell cd /tmp/openstack/tempest && ./run_tests.sh -V -- "-w tempest/tests/image"
tags: tempest
- name: run some volume tests
action: shell cd /tmp/openstack/tempest && ./run_tests.sh -V -- "-w tempest/tests/volume"
tags: tempest
- name: run some network tests
action: shell cd /tmp/openstack/tempest && ./run_tests.sh -V -- "-w tempest/tests/network"
tags: tempest
- name: run some EC2 compatibility tests
action: shell cd /tmp/openstack/tempest && ./run_tests.sh -V -- "-w tempest/tests/boto"
tags: tempest
- name: run some object storage (swift) tests
action: shell cd /tmp/openstack/tempest && ./run_tests.sh -V -- "-w tempest/tests/object_storage"
tags: tempest
- name: run some compute tests
action: shell cd /tmp/openstack/tempest && ./run_tests.sh -V -- "-w tempest/tests/compute"
tags: tempest