-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevstack.yaml
More file actions
219 lines (173 loc) · 5.77 KB
/
Copy pathdevstack.yaml
File metadata and controls
219 lines (173 loc) · 5.77 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
---
# Fire up a OpenStack instance in EC2 using DevStack script ....
#
# 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
- devstack/vars/devstack-vars.yaml
tasks:
- name: Fire up a node in EC2
action: ec2
keypair=${ec2_keypair}
id=devstack_1
instance_type=${devstack_ec2_type}
image=${ec2_image}
wait=true
group=${ec2_sec_group}
register: ec2
- 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=devstack
with_items: ${ec2.instances}
# Note: the "only_if" below doesn't work, because the ec2 module always returns "changed=true"
# - name: Create volumes and attach (will fail if volumes already setup...)
# action: ec2_vol instance=${item.id} volume_size=${cinder_volume_size}
# with_items: ${ec2.instances}
# only_if: '${ec2.changed}'
# register: ec2_volumes
# ignore_errors: yes
#
# Dump data on these hosts.
#
- hosts: devstack
vars_files:
- iaas/vars/ec2-vars.yaml
- devstack/vars/devstack-vars.yaml
user: '${remote_user}'
sudo: False
gather_facts: True
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
#---------------------------------
# Bootstrap needed packages first,
# and let me run as sudo
#---------------------------------
- hosts: devstack
vars_files:
- iaas/vars/ec2-vars.yaml
- devstack/vars/devstack-vars.yaml
user: '${remote_user}'
sudo: True
gather_facts: True
tasks:
- name: let me run as sudo
action: lineinfile dest=/etc/sudoers regexp="^Defaults *requiretty" state=absent
- name: install basic packages
action: yum name=${item} state=present
with_items:
- git
- which
- bind-utils
- tar
- gzip
- lvm2
- emacs-nox
- name: write our own local iptables rules
action: copy src=devstack/files/iptables-devstack dest=/etc/sysconfig/iptables owner=root group=root mode=0600
# this is "firewalld" for F18
- name: turn off the firewall so we can talk to the services
action: service name=iptables state=restarted
- name: disable SELinux
action: selinux policy=targeted state=permissive
#
# Fix for ceilomter: install mondodb
#
- name: install mongodb
action: yum name=mongodb-server state=present
#
# Fix for NOVA on Fedora 18
#
# https://github.com/openstack-dev/devstack/commit/a534e0bf1a1ec0abc1d1f673af1b70fbf8239350
# - name: add devstack user to policy kit
# action: template src=devstack/templates/50-libvirt-user.rules dest=/etc/polkit-1/rules.d/50-libvirt-${remote_user}.rules owner=root group=root mode=0664
#
# Setup /opt/stack for tweaks
#
- name: setup /opt/stack ahead of time
action: file path=/opt/stack state=directory owner=${remote_user} group=${remote_user} mode=0775
#
# Setup a volume group from the EBS volume we mounted
#
- name: setup a volume group for Cinder
action: lvg pvs=/dev/xvdb vg=stack-volumes state=present
#----------------------------
#
# Put NodeJS in place
# for horizon
#
#----------------------------
- hosts: devstack
vars_files:
- iaas/vars/ec2-vars.yaml
- devstack/vars/devstack-vars.yaml
user: '${remote_user}'
sudo: False
gather_facts: True
tasks:
# yum localinstall --nogpgcheck http://nodejs.tchol.org/repocfg/fedora/nodejs-stable-release.noarch.rpm
# yum -y install nodejs nodejs-compat-symlinks
# systemctl restart httpd.service
- name: pull nodejs
action: git repo=git://github.com/creationix/nvm.git dest=/opt/stack/nvm
- name: install nodejs
action: shell cd /opt/stack/nvm && source ./nvm.sh && nvm install 0.8.14 && nvm alias default 0.8.14
- name: put node stuff into /usr/local/bin
action: shell sudo ln -sf /opt/stack/nvm/v0.8.14/bin/* /usr/local/bin/
- name: put node stuff into /usr/local/lib
action: shell sudo ln -sf /opt/stack/nvm/v0.8.14/lib/* /usr/local/lib
#----------------------------
#
# Pull & configure DevStack
#
#----------------------------
- hosts: devstack
vars_files:
- iaas/vars/ec2-vars.yaml
- devstack/vars/devstack-vars.yaml
user: '${remote_user}'
sudo: False
gather_facts: True
tasks:
- name: ec2 facts
action: ec2_facts
register: ec2_facts
- name: add paths as needed
action: copy src=devstack/files/bashrc dest=/home/${remote_user}/.bashrc
#
# Get Devstack
#
- name: checkout devstack
action: git repo=${devstack_url} dest=/home/${remote_user}/devstack version=${devstack_branch}
- name: create localrc
action: template src=devstack/templates/localrc dest=/home/${remote_user}/devstack/localrc owner=${remote_user} group=${remote_user} mode=0664
- name: create local.sh
action: template src=devstack/templates/local.sh dest=/home/${remote_user}/devstack/local.sh owner=${remote_user} group=${remote_user} mode=0775
#
# Fix horizon.conf for apache on F18
#
# - name: fix the horizon.conf file
# action: template
# src=templates/apache-horizon.template
# dest=/home/vagrant/devstack/files/apache-horizon.template
# owner=vagrant
# group=vagrant
# mode=0664
# - name: abandon ship
# action: shell /bin/false
# tags: swift
- name: run devstack
action: shell cd ./devstack && ./unstack.sh && FORCE=yes ./stack.sh 2>&1 > devstack.log