-
Notifications
You must be signed in to change notification settings - Fork 1
/
provision.yml
218 lines (191 loc) · 6.11 KB
/
provision.yml
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
---
- hosts: all
tasks:
- name: Install the bare necessities (apt)
apt:
name: "{{item}}"
update_cache: yes
with_items:
- git
- postgresql-client
- libldap2-dev
- libsasl2-dev
- libssl-dev
- libvirt-bin
- silversearcher-ag
- sudo
- vim
become: true
- name: Install the bare necessities (pip)
pip:
name: "{{item}}"
with_items:
- ipython
- ipdb
- tox
- virtualenv
become: true
# ------------------------------------------------------------- CockroachDB
- name: Getting CockroachDB binary
get_url:
url: https://binaries.cockroachdb.com/cockroach-v1.1.2.linux-amd64.tgz
dest: ~/cockroach.tgz
- name: Unzip CockroachDB binary
unarchive:
src: ~/cockroach.tgz
dest: /tmp
- name: Install CockroachDB
shell: cp -i /tmp/cockroach-*.linux-amd64/cockroach /usr/local/bin
args:
creates: /usr/local/bin/cockroach
become: true
- name: Checking if CockroachDB is running
shell: ps -ef | grep -v grep | grep "cockroach start" | wc -l
register: cockroach_is_started
- name: Start CockroachDB
command: cockroach start --host=localhost --port=26257 --insecure --background
args:
chdir: /home/vagrant
when: not cockroach_is_started.stdout|int|bool
- name: Install CockroachDB SQLAlchemy Dialect + Updated version of sqlalchemy-migrate
pip:
name: "{{item}}"
editable: true # Doesn't work (https://github.com/ansible/ansible/issues/8355)
with_items:
- -e git+https://github.com/cockroachdb/cockroachdb-python.git#egg=cockroachdb
- -e git+https://github.com/rcherrueau/sqlalchemy-migrate.git@cockroachdb/pike#egg=sqlalchemy-migrate
become: true
# ---------------------------------------------------------------- Devstack
- name: Add stack user
user:
name: stack
shell: /bin/bash
home: /opt/stack
system: yes
become: true
- name: Always connect as stack user
blockinfile:
name: ~/.bashrc
state: present
block: |
sudo su stack
- name: Source OS env at stack connection
blockinfile:
name: ~/.bashrc
state: present
block: |
. /opt/stack/devstack/openrc admin admin
become: true
become_user: stack
- name: Make stack user a becomeers
lineinfile:
dest: /etc/sudoers.d/stack
line: "stack ALL=(ALL) NOPASSWD: ALL"
create: yes
become: true
- name: Clone Devstack in /devstack
git:
repo: https://git.openstack.org/openstack-dev/devstack
version: stable/pike
dest: /opt/stack/devstack
force: yes
update: no
depth: 1
become: true
become_user: stack
- name: Patching devstack (host-ip)
shell: "sed -i 's/HOST_IP=${HOST_IP:-}/ HOST_IP=10.0.2.15/' /opt/stack/devstack/stackrc"
become: true
become_user: stack
- name: Patching devstack (Add support to cockroachdb database)
copy:
src: patch/lib-cockroachdb
dest: /opt/stack/devstack/lib/databases/cockroachdb
owner: stack
become: true
become_user: stack
- name: Patching devstack (Put cockroachdb context around keystone/nova)
copy:
src: patch/stack.sh
dest: /opt/stack/devstack/stack.sh
owner: stack
mode: 0755
become: true
become_user: stack
- name: Create the devstack local.conf
blockinfile:
path: /opt/stack/devstack/local.conf
marker: "# {mark} MINIMAL DEVSTACK"
block: |
[[local|localrc]]
ADMIN_PASSWORD=admin
DATABASE_HOST=127.0.0.1
DATABASE_USER=root
DATABASE_PASSWORD=
RABBIT_PASSWORD=admin
SERVICE_PASSWORD=admin
LIBVIRT_TYPE=qemu
WSGI_MODE=uwsgi
LIBS_FROM_GIT=oslo.db
OSLODB_REPO=https://github.com/BeyondTheClouds/oslo.db
OSLODB_BRANCH=cockroachdb/pike
KEYSTONE_REPO=https://github.com/BeyondTheClouds/keystone
KEYSTONE_BRANCH=cockroachdb/pike
# Note: Find services in $ENABLED_SERVICES
disable_service c-api
disable_service c-sch
disable_service c-vol
# disable_service dstat
# disable_service etcd3
# disable_service g-api
# disable_service g-reg
disable_service horizon
# disable_service n-api-meta
# disable_service n-api
# disable_service n-cauth
# disable_service n-cond
# disable_service n-cond-cell1
# disable_service n-cpu
# disable_service n-novnc
# disable_service n-sch
# disable_service n-super-cond
# disable_service placement-api
# disable_service placement-client
# disable_service q-agt
# disable_service q-dhcp
# disable_service q-l3
# disable_service q-meta
# disable_service q-svc
# disable_service tempest
disable_service mysql
enable_service postgresql
enable_service cockroachdb
enable_plugin rally https://github.com/openstack/rally master
[[post-config|$KEYSTONE_CONF]]
[database]
connection_debug = 50
# [DEFAULT]
# default_log_levels = amqp=WARN,amqplib=WARN,boto=WARN,qpid=WARN,sqlalchemy=DEBUG,suds=INFO,oslo.messaging=INFO,iso8601=WARN,requests.packages.urllib3.connectionpool=WARN,urllib3.connectionpool=WARN,websocket=WARN,requests.packages.urllib3.util.retry=WARN,urllib3.util.retry=WARN,keystonemiddleware=WARN,routes.middleware=WARN,stevedore=WARN,taskflow=WARN,keystoneauth=WARN,oslo.cache=INFO,dogpile.core.dogpile=INFO
[[post-config|$NOVA_CONF]]
[database]
connection_debug = 50
create: yes
become: true
become_user: stack
- name: Clear Devstack
shell: /opt/stack/devstack/unstack.sh &> /tmp/stack-logs
args:
executable: /bin/bash
become: true
become_user: stack
- name: Start of Devstack deployment
debug:
msg:
- "Follow deployment with:"
- "vagrant ssh -- tail -f /tmp/stack-logs"
- name: Run Devstack
shell: /opt/stack/devstack/stack.sh &> /tmp/stack-logs
args:
executable: /bin/bash
become: true
become_user: stack