- ntopng for 9 or 10 - build from git
This commit is contained in:
25
roles/common/vars/os_Raspbian_9.yml
Normal file
25
roles/common/vars/os_Raspbian_9.yml
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
dependency_packages:
|
||||
- expect
|
||||
- ftp
|
||||
- cadaver
|
||||
- iperf
|
||||
- iperf3
|
||||
- libpcap0.8
|
||||
- libsctp1
|
||||
- libsctp-dev
|
||||
- libncurses-dev
|
||||
- libssl-dev
|
||||
- libpcap-dev
|
||||
- vim
|
||||
- mc
|
||||
- smbclient
|
||||
- ncurses-dev
|
||||
- build-essential
|
||||
- openvpn
|
||||
- lightdm
|
||||
- lxde
|
||||
- realvnc-vnc-server
|
||||
- aptitude
|
||||
- chromium-browser
|
||||
- raspberrypi-ui-mods
|
||||
3
roles/ntopng/files/ntopng
Normal file
3
roles/ntopng/files/ntopng
Normal file
@@ -0,0 +1,3 @@
|
||||
#
|
||||
# Command line options for ntopng...
|
||||
OPTIONS="/etc/ntopng/ntopng.conf"
|
||||
60
roles/ntopng/files/ntopng.conf
Normal file
60
roles/ntopng/files/ntopng.conf
Normal file
@@ -0,0 +1,60 @@
|
||||
#
|
||||
# ntopng Configuration File: NST 2013
|
||||
# ====== ============= ===== === ====
|
||||
|
||||
#
|
||||
# ***Note: When using this file with the NST WUI then
|
||||
# 'Only' use the ntopng long option formats.
|
||||
|
||||
#
|
||||
# Verbose (Debug)
|
||||
# ======= =======
|
||||
#--verbose
|
||||
|
||||
#
|
||||
# Network Interface(s):
|
||||
# ======= =============
|
||||
# ***Note: To add more than one interface use multiple entries:
|
||||
#--interface p3p1
|
||||
#--interface p3p2
|
||||
--interface eth0
|
||||
|
||||
#
|
||||
# HTTP Access Port:
|
||||
# ==== ====== =====
|
||||
--http-port 3000
|
||||
|
||||
#
|
||||
# Local Networks:
|
||||
# ===== =========
|
||||
# ***Note: To add more than one local network comma separate:
|
||||
# --local-networks 172.16.1.0/24,172.31.1.0/24
|
||||
--local-networks 192.168.1.0/24
|
||||
|
||||
#
|
||||
# ntopng Working Directory:
|
||||
# ====== ======= ==========
|
||||
--data-dir /var/nst/ntopng
|
||||
|
||||
#
|
||||
# DNS Address Resolution Mode:
|
||||
# === ======= ========== =====
|
||||
--dns-mode 1
|
||||
|
||||
#
|
||||
# Web Interface Logout For Inactivity:
|
||||
# === ========= ====== === ===========
|
||||
--disable-autologout
|
||||
|
||||
#
|
||||
# Disable Alerts:
|
||||
# ======= =======
|
||||
--disable-alerts
|
||||
|
||||
#
|
||||
# Sticky Hosts
|
||||
# ====== =====
|
||||
--sticky-hosts none
|
||||
#--sticky-hosts local
|
||||
#--sticky-hosts remote
|
||||
#--sticky-hosts all
|
||||
13
roles/ntopng/files/ntopng.service
Normal file
13
roles/ntopng/files/ntopng.service
Normal file
@@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=ntopng Service
|
||||
Requires=redis.service
|
||||
After=syslog.target network.target redis.service
|
||||
|
||||
[Service]
|
||||
TimeoutStopSec=10s
|
||||
EnvironmentFile=/etc/default/ntopng
|
||||
WorkingDirectory=/usr/share/ntopng
|
||||
ExecStart=/usr/local/bin/ntopng $OPTIONS
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -1,25 +1,57 @@
|
||||
---
|
||||
- name: Check if ntopng is installed
|
||||
become: yes
|
||||
command: dpkg-query -W "{{ ntopng_deb }}"
|
||||
register: ntopng_check_deb
|
||||
failed_when: ntopng_check_deb.rc > 1
|
||||
changed_when: ntopng_check_deb.rc == 1
|
||||
- name: Download ntopng
|
||||
get_url:
|
||||
url="{{ ntopng_deb_url }}"
|
||||
dest="/home/{{ ansible_env.USER }}/Downloads/{{ ntopng_deb }}.deb"
|
||||
when: ntopng_check_deb.rc == 1
|
||||
- name: Install ntopng source
|
||||
become: yes
|
||||
apt: deb="/home/{{ ansible_env.USER }}/Downloads/{{ ntopng_deb }}.deb"
|
||||
when: ntopng_check_deb.rc == 1
|
||||
- name: install ntopng
|
||||
become: yes
|
||||
apt:
|
||||
name: ntopng
|
||||
- name: Include OS-specific variables
|
||||
include_vars: "os_{{ ansible_lsb.id }}_{{ ansible_lsb.major_release }}.yml"
|
||||
- name: install package dependencies
|
||||
become: true
|
||||
package:
|
||||
name: "{{ ntopng_dependency_packages }}"
|
||||
state: present
|
||||
update_cache: yes
|
||||
- name: clone nDPI
|
||||
git:
|
||||
repo: https://github.com/ntop/nDPI.git
|
||||
dest: "{{ ansible_user_dir }}/nDPI"
|
||||
- name: clone ntopng
|
||||
git:
|
||||
repo: https://github.com/ntop/ntopng.git
|
||||
dest: "{{ ansible_user_dir }}/ntopng"
|
||||
- name: build nDPI
|
||||
command: "./autogen.sh && ./configure --with-pic && make"
|
||||
args:
|
||||
chdir: "{{ ansible_user_dir }}/nDPI"
|
||||
- name: build ntopng
|
||||
command: "./autogen.sh && ./configure && make"
|
||||
args:
|
||||
chdir: "{{ ansible_user_dir }}/ntopng"
|
||||
- name: install
|
||||
become: yes
|
||||
command: "make install"
|
||||
args:
|
||||
chdir: "{{ ansible_user_dir }}/ntopng"
|
||||
- name: create directories
|
||||
become: yes
|
||||
file:
|
||||
path: "{{ items }}"
|
||||
state: directory
|
||||
owner: ntopng
|
||||
group: ntopng
|
||||
with_items:
|
||||
- /var/nst/ntopng
|
||||
- /usr/share/ntopng
|
||||
- /etc/ntopng
|
||||
- name: copy files
|
||||
template:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
owner: root
|
||||
group: root
|
||||
with_items:
|
||||
- { src: "{{ role_path }}/files/ntopng", dest: "/etc/default/ntopng" }
|
||||
- { src: "{{ role_path }}/files/ntopng.conf", dest: "/etc/ntopng/ntopng.conf" }
|
||||
- { src: "{{ role_path }}/files/ntopng.service", dest: "/etc/systemd/system/ntopng.service" }
|
||||
- name: reload systemd
|
||||
become: true
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
- name: start ntopng
|
||||
become: yes
|
||||
systemd:
|
||||
|
||||
13
roles/ntopng/vars/os_Raspbian_10.yml
Normal file
13
roles/ntopng/vars/os_Raspbian_10.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
ntopng_dependency_packages:
|
||||
- autoconf
|
||||
- shtool
|
||||
- libtool
|
||||
- libcurl4-openssl-dev
|
||||
- libsqlite3-dev
|
||||
- libmariadbclient-dev
|
||||
- libreadline-dev
|
||||
- libxml2-dev
|
||||
- libglib2.0-dev
|
||||
- redis
|
||||
- libmaxminddb-dev
|
||||
13
roles/ntopng/vars/os_Raspbian_9.yml
Normal file
13
roles/ntopng/vars/os_Raspbian_9.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
ntopng_dependency_packages:
|
||||
- autoconf
|
||||
- shtool
|
||||
- libtool
|
||||
- libcurl4-openssl-dev
|
||||
- libsqlite3-dev
|
||||
- libmariadbclient-dev
|
||||
- libreadline-dev
|
||||
- libxml2-dev
|
||||
- libglib2.0-dev
|
||||
- redis-server
|
||||
- libmaxminddb-dev
|
||||
Reference in New Issue
Block a user