-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsite.yml
186 lines (159 loc) · 4.9 KB
/
site.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
---
- name: Install the Software
tags: software
hosts: hadoopnodes
vars:
nbis_prefix: "/usr/local"
nbis_configure_args: "--64 --without-X11"
nbis_version: "5.0.0"
nbis_src_url: "http://nigos.nist.gov:8080/nist/nbis/nbis_v{{ nbis_version | replace('.', '_') }}.zip"
nbis_src_zip: "{{ nbis_src_url | basename }}"
nbis_src_checksum: "sha256:0adf8ab0f6b0e4208de50ca00ba21d3d77112ecd66288757ddfed21f6bee92c3"
nbis_src_name: "{{ nbis_src_zip | splitext | first }}"
tasks:
##################################################
# Debian
##################################################
- name: add repository keys (Debian)
when: ansible_os_family == 'Debian'
become: yes
apt_key:
keyserver: "keyserver.ubuntu.com"
id: "642AC823"
state: present
- name: add repositories (Debian)
when: ansible_os_family == 'Debian'
become: yes
apt_repository:
repo: "deb https://dl.bintray.com/sbt/debian /"
state: present
update_cache: yes
- name: install dependencies (Debian)
when: ansible_os_family == 'Debian'
become: yes
apt:
name: "{{ item }}"
state: present
with_items:
- build-essential
- cmake
- unzip
- sbt
##################################################
# RedHat
##################################################
- name: add repository (RedHat)
when: ansible_os_family == 'RedHat'
become: yes
get_url:
url: "https://bintray.com/sbt/rpm/rpm"
dest: /etc/yum.repos.d/binary-sbt-rpm.repo
- name: install dependencies (RedHat)
when: ansible_os_family == 'RedHat'
become: yes
yum:
name: "{{ item }}"
state: present
with_items:
- cmake
- unzip
- name: install dependencies (unsigned packages) (RedHat)
when: ansible_os_family == 'RedHat'
become: yes
yum:
name: "{{ item }}"
state: present
disable_gpg_check: yes
with_items:
- sbt
##################################################
- name: download NBIS
get_url:
url: "{{ nbis_src_url }}"
dest: "/tmp"
checksum: "{{ nbis_src_checksum }}"
- name: extract
unarchive:
src: "/tmp/{{ nbis_src_zip }}"
dest: "{{ ansible_env.HOME }}"
creates: "{{ ansible_env.HOME }}/Rel_{{ nbis_version }}"
copy: no
- name: configure and build
shell: "{{ item.cmd }} && touch {{ item.creates }}"
args:
chdir: "{{ ansible_env.HOME }}/Rel_{{ nbis_version }}"
creates: "{{ item.creates }}"
with_items:
- cmd: "./setup.sh {{ nbis_prefix }} {{ nbis_configure_args }}"
creates: .ran-setup.sh
- cmd: "make config"
creates: .ran-make:config
- cmd: "make it"
creates: .ran-make:it
- name: install
become: yes
shell: "make install && touch .ran-make:install"
args:
chdir: "{{ ansible_env.HOME }}/Rel_{{ nbis_version }}"
creates: ".ran-make:install"
- name: Deploy the dataset
tags: data
hosts: frontendnodes
vars:
download_dir: "/tmp"
db_dir: "/tmp/nist"
db4_path: "{{ db_dir }}/{{ databases.4.url | splitext | first }}"
databases:
4:
url: "https://s3.amazonaws.com/nist-srd/SD4/NISTSpecialDatabase4GrayScaleImagesofFIGS.zip"
sha512: "8fb35d27c4bbb1e15008fbdad0fae0fc64fa0b5cff12259753ca039223cf1b789ff2362ca2889c4a9777b71f85a4101c3338155e3c6fc5f8f22fa146d21e941b"
tasks:
- name: prepare the data directory
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ download_dir }}"
- "{{ db_dir }}"
- name: download
get_url:
url: "{{ databases.4.url }}"
checksum: "sha512:{{ databases.4.sha512 }}"
dest: "{{ download_dir }}"
timeout: 60
- name: extract
become: yes
unarchive:
src: "{{ download_dir }}/{{ databases.4.url | basename }}"
dest: "{{ db_dir }}"
owner: hadoop
group: hadoop
creates: "{{ db4_path }}"
copy: false
- name: fix permissions
become: yes
file:
path: "{{ db_dir }}"
owner: hadoop
group: hadoop
recurse: yes
- debug: msg="The next step can take a while. Please be patient"
- name: import databases into hdfs
become: yes
become_user: hadoop
shell: "sh -lc 'hadoop fs -put {{ db_dir }} / && touch {{ db_dir }}/.imported-to-hdfs'"
args:
creates: "{{ db_dir }}/.imported-to-hdfs"
- name: Run the analysis code
tags: analysis
hosts: frontendnodes
tasks:
- name: copy the analysis scripts
become: yes
copy:
src: "{{ item }}"
dest: "/home/hadoop/{{ item | basename }}"
owner: hadoop
with_items:
- ./NBIS.sbt
- ./NBIS.scala