- ntopng for 9 or 10 - build from git

This commit is contained in:
Pi
2019-07-22 16:46:20 -04:00
parent 8b47769192
commit d181aee61d
7 changed files with 179 additions and 20 deletions

View File

@@ -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: