forked from amcaar/tma-yaml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmaframework.radl
250 lines (212 loc) · 6.81 KB
/
tmaframework.radl
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
network public (outbound = 'yes')
network private ()
system front (
cpu.arch='x86_64' and
cpu.count>=2 and
memory.size>=8g and
net_interface.0.connection = 'private' and
net_interface.0.dns_name = 'kubeserver' and
net_interface.1.connection = 'public' and
net_interface.1.dns_name = 'kubeserverpublic' and
disk.0.os.name='linux' and
disk.0.image.url = 'fbw://fogbow-ubuntu' and
disk.0.applications contains (name='ansible.modules.grycap.kubernetes')
)
system wn (
cpu.arch='x86_64' and
cpu.count>=4 and
memory.size>=4g and
net_interface.0.connection = 'private' and
net_interface.0.dns_name = 'wn-#N#' and
disk.0.os.name='linux' and
disk.0.image.url = 'fbw://fogbow-ubuntu'
)
system ceph (
cpu.arch='x86_64' and
cpu.count>=2 and
memory.size>=4g and
net_interface.0.connection = 'private' and
net_interface.0.dns_name = 'cephserver' and
#net_interface.1.connection = 'public' and
#net_interface.1.dns_name = 'cephserverpublic' and
disk.0.os.name='linux' and
disk.0.image.url = 'fbw://fogbow-ubuntu'
)
configure kubefront (
@begin
---
- pre_tasks:
- name: Create dir for the NFS PV
file: path=/pv state=directory mode=755
- name: Create auth file dir
file: path=/etc/kubernetes/pki state=directory mode=755 recurse=yes
- name: Create auth data file with an admin user
copy: content='sometoken,kubeuser,100,"users,system:masters"' dest=/etc/kubernetes/pki/auth mode=600
roles:
#- role: 'grycap.nfs'
# nfs_mode: 'front'
# nfs_exports: [{path: "/pv", export: "wn-*.localdomain(fsid=0,rw,async,no_root_squash,no_subtree_check,insecure)"}]
- role: 'grycap.kubernetes'
kube_server: 'kubeserver'
kube_apiserver_options: [{option: "--insecure-port", value: "8080"}, {option: "--token-auth-file", value: "/etc/kubernetes/pki/auth"}]
kube_deploy_dashboard: true
kube_install_helm: true
kube_install_metrics: true
#kube_apply_repos: [{repo: "https://github.com/eubr-atmosphere/tma-yaml", version: "master", path: "integrated/"}]
@end
)
configure kubewn (
@begin
---
- roles:
#- role: 'grycap.nfs'
# nfs_mode: 'wn'
- role: 'grycap.kubernetes'
kube_type_of_node: 'wn'
kube_server: 'kubeserver'
@end
)
configure installceph (
@begin
---
- tasks:
- name: Install Ceph
apt: name=ceph update_cache=yes
@end
)
configure installcephnode (
@begin
---
- tasks:
- name: Install git package
package: name=git
- name: Git clone tma-framework-k repo for ceph scripts
git: repo='https://github.com/eubr-atmosphere/tma-framework-k.git' dest=/tmp/tma version=master force=yes
- name: Changing perm of "ceph_installation.sh", adding "+x"
file: path=/tmp/tma/development/ceph/ceph_installation.sh mode=0777
- name: Get netmask
shell: ip -o -f inet addr show 'ens3' | awk '/scope global/ {print $4}'
register: NETWORK
changed_when: false
- name: Modify "ceph_installation.sh" to have the ceph IP
lineinfile:
path: /tmp/tma/development/ceph/ceph_installation.sh
regexp: '192.168.1.1'
line: " -e MON_IP={{ hostvars[groups['ceph'][0]]['IM_NODE_PRIVATE_IP'] }} -e CEPH_PUBLIC_NETWORK={{NETWORK.stdout }} docker.avvo.com/ceph-demo:luminous"
state: present
- lineinfile:
path: /tmp/tma/development/ceph/ceph_installation.sh
regexp: 'docker run'
line: 'docker run -d --net=host -v /etc/ceph:/etc/ceph -v /var/lib/ceph:/var/lib/ceph \'
state: present
- name: Execute ceph installation script
command: sh ceph_installation.sh chdir=/tmp/tma/development/ceph/
@end
)
configure confcephnode (
@begin
---
- tasks:
- name: enable ceph rbd
command: ceph osd pool application enable rbd rbd
- name: ceph crush tunables
command: ceph osd crush tunables hammer
- name: Get Kernel release
command: uname -r
register: KERNEL_RELEASE
changed_when: false
- name: Changing perm of "ceph_configuration.sh", adding "+x"
file: path=/tmp/tma/development/ceph/ceph_configuration.sh mode=0777
# - lineinfile:
# path: /tmp/tma/development/ceph/ceph_configuration.sh
# regexp: 'mkfs.ext4 /dev/rbd0'
# line: '#mkfs.ext4 /dev/rbd0'
# state: present
- name: Execute ceph configuration script
shell: sh ceph_configuration.sh >> /tmp/key.txt chdir=/tmp/tma/development/ceph/ creates=/tmp/key.txt
- name: Check kernel version and disable ceph feature if needed
command: rbd feature disable tma_k_db_mysql exclusive-lock
when: KERNEL_RELEASE.stdout | version_compare('4.12.0', '<=')
@end
)
configure cephkey (
@begin
---
- tasks:
- fetch:
src: /tmp/key.txt
dest: /tmp/key.txt
flat: yes
fail_on_missing: no
@end
)
configure tmadeployment (
@begin
---
- tasks:
- name: Download git repo of the TMA YAML
git:
repo: https://github.com/eubr-atmosphere/tma-yaml
dest: /tmp/tma-yaml
version: master
- name: Modify ceph key in TMA YAML
lineinfile:
path: /tmp/tma-yaml/integrated/tma_deployment.yaml
regexp: 'QVFENzZITmNQUTJ5Q1JBQVU4OUJTdEEzaFdYMnl1cU1DNGlKSkE9PQo='
line: " key: {{ lookup('file', '/tmp/key.txt') }}"
state: present
- name: Modify ceph IP in TMA YAML
lineinfile:
path: /tmp/tma-yaml/integrated/tma_deployment.yaml
regexp: '192.168.122.37'
line: " - {{ hostvars[groups['ceph'][0]]['IM_NODE_PRIVATE_IP'] }}:6789"
state: present
@end
)
configure kubeproxy (
@begin
---
- tasks:
- name: initialize kube-proxy service for TMA_Analyze
shell: kubectl proxy --address kubeserverpublic.localdomain --port=8089 --accept-hosts '.*' &
environment:
KUBECONFIG: /etc/kubernetes/admin.conf
@end
)
configure kubeapply (
@begin
---
- tasks:
- name: apply TMA YAML
command: kubectl apply -f /tmp/tma-yaml/integrated/tma_deployment.yaml chdir="/tmp/tma-yaml/integrated"
environment:
KUBECONFIG: /etc/kubernetes/admin.conf
@end
)
configure clean (
@begin
---
- tasks:
- name: wait for the pods to be running
wait_for:
path: /var/lib/kubelet/plugins/kubernetes.io/rbd/mounts/rbd-image-tma_k_db_mysql/lost+found/
- name: delete residual files in rbd image
command: rm -rf /var/lib/kubelet/plugins/kubernetes.io/rbd/mounts/rbd-image-tma_k_db_mysql/lost+found/
@end
)
deploy front 1
deploy wn 1
deploy ceph 1
contextualize 100000 (
system front configure kubefront step 1
system front configure installceph step 2
system ceph configure installcephnode step 3
system wn configure kubewn step 3
system wn configure installceph step 4
system ceph configure confcephnode step 5
system ceph configure cephkey step 6
system front configure tmadeployment step 7
system front configure kubeproxy step 8
system front configure kubeapply step 9
#system wn configure clean step 10
)