-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnfsen-porttracker.yml
73 lines (62 loc) · 2.13 KB
/
nfsen-porttracker.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
- hosts: netflow_server
become: true
vars:
ansible_python_interpreter: /usr/bin/python3
locale: en_US.UTF-8
ansible_ssh_pipelining: yes
tasks:
- name: check nftrack data directory
stat:
path: /var/ports-db
ignore_errors: true
register: nftrack_folder
tags: porttracker_plugins
- name: creates directory for nftrack data
file:
path: /var/ports-db
state: directory
recurse: yes
owner: netflow
group: www-data
when: nftrack_folder.stat.exists == false
tags: porttracker_plugins
- name: change nftrack path PortTracker
shell: sed -i 's|/data/ports-db|/var/ports-db|g' PortTracker.pm
args:
chdir: '/usr/local/src/nfsen-1.3.8/contrib/PortTracker/'
tags: porttracker_plugins
- name: copy necessary files
shell: |
cp /usr/local/src/nfsen-1.3.8/contrib/PortTracker/PortTracker.pm /var/nfsen/plugins/
cp /usr/local/src/nfsen-1.3.8/contrib/PortTracker/PortTracker.php /var/nfsen/plugins/
cp /usr/local/src/nfsen-1.3.8/contrib/PortTracker/PortTracker.php /var/www/html/nfsen/plugins
become: yes
tags: porttracker_plugins, copy-files
- name: activate PortTracker plugins
lineinfile:
dest: /var/nfsen/etc/nfsen.conf
insertafter: '@plugins'
line: "\t['live', 'PortTracker'],"
- name: initialize the PortTracker database files - this might take a while
command: sudo -u netflow nftrack -I -d /var/ports-db
tags: porttracker_plugins
- name: fix file ownership and group
file:
path: /var/ports-db
owner: netflow
group: www-data
recurse: yes
tags: porttracker_plugins
- name: fix files permission
file:
path: /var/ports-db/
mode: '664'
tags: porttracker_plugins
- name: fix folder permission
file:
path: /var/ports-db
mode: '775'
tags: porttracker_plugins
- name: restart nfsen
shell: systemctl restart nfsen.service
tags: porttracker_plugins