-
-
Notifications
You must be signed in to change notification settings - Fork 59
/
01_spamscope_install.yml
170 lines (150 loc) · 4.1 KB
/
01_spamscope_install.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
---
- name: Install SpamScope
hosts: develop
gather_facts: yes
become: true
become_method: su
tasks:
- name: Install lein
get_url:
url: "{{ lein_url }}"
dest: "{{ bin_path }}"
mode: 0775
- name: Install all SpamScope system dependencies
apt:
name: "{{ item }}"
update_cache: yes
with_items:
- autoconf
- automake
- build-essential
- cmake
- git
- graphviz
- graphviz-dev
- libboost-all-dev
- libboost-python-dev
- libemail-outlook-message-perl
- libffi-dev
- libfuzzy-dev
- libjpeg-dev
- libtool
- libxml2-dev
- libxslt-dev
- libxslt1-dev
- libyaml-dev
- p7zip-full
- pkg-config
- python-dev
- python-pip
- python-setuptools
- spamassassin
- unzip
- yara
- zlib1g-dev
- name: Install virtualenv
pip:
name: virtualenv
state: latest
- name: Make SpamScope worker folders
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ spamscope_conf_path }}"
- "/var/log/spamscope"
- "/var/lib/spamscope/moved"
- "/var/lib/spamscope/failed"
- "/var/lib/spamscope/output"
- name: Copy SpamScope main configuration file
template:
src: templates/spamscope.yml.j2
dest: "{{ spamscope_conf_path }}/spamscope.yml"
- name: Copy others SpamScope configuration files
copy:
src: "files/{{ item }}"
dest: "{{ spamscope_conf_path }}/{{ item }}"
with_items:
- tika_whitelist.yml
- name: Download Apache Tika in local
become: false
get_url:
url: "{{ apache_tika_url }}"
dest: "/tmp"
delegate_to: localhost
- name: Copy Apache Tika on server
copy:
src: "/tmp/tika-app-{{ apache_tika_version }}.jar"
dest: "{{ install_path }}"
- name: Clone Faup
git:
dest: "{{ faup_path }}"
repo: "{{ faup_repo }}"
update: yes
clone: yes
accept_hostkey: yes
version: master
tags:
- git
- name: Build Faup
shell: "{{ item }}"
args:
chdir: "{{ faup_path }}/build"
with_items:
- cmake ..
- make
- make install
- echo '/usr/local/lib' | tee -a /etc/ld.so.conf.d/faup.conf && ldconfig
- name: Download rarlinux
become: false
get_url:
url: "{{ rarlinux_url }}"
dest: "/tmp"
delegate_to: localhost
- name: Copy rarlinux on server
copy:
src: "/tmp/{{ rarlinux_filename }}"
dest: "{{ install_path }}"
- name: Unarchive rarlinux file archive
unarchive:
src: "/tmp/{{ rarlinux_filename }}"
dest: "{{ install_path }}"
- name: Remove rarlinux file archive
file:
path: "{{ install_path }}/{{ rarlinux_filename }}"
state: absent
- name: Make rarlinux symbolic links in bin path
file:
src: "{{ install_path }}/rar/{{ item }}"
dest: "{{ bin_path }}/{{ item }}"
state: link
with_items:
- rar
- unrar
- name: Clone SpamScope repository
git:
dest: "{{ spamscope_path }}"
repo: "{{ spamscope_repo }}"
update: yes
clone: yes
force: yes
accept_hostkey: yes
version: "{{ spamscope_version }}"
tags:
- git
- name: Copy streamparse config.json file
template:
src: templates/config.json.j2
dest: "{{ spamscope_path }}/config.json"
- name: Install SpamScope
pip:
name: "git+{{ spamscope_repo }}@{{ spamscope_version }}"
virtualenv: "{{ spamscope_path }}/venv"
- name: Install SpamScope requirements optional
pip:
requirements: "{{ spamscope_path }}/requirements_optional.txt"
virtualenv: "{{ spamscope_path }}/venv"
- name: Enable SpamScope environment variable
template:
src: templates/spamscope.sh.j2
dest: /etc/profile.d/spamscope.sh