Files
dsfin-ansible/roles/ntopng/tasks/main.yaml
2019-07-24 15:15:26 +01:00

90 lines
2.4 KiB
YAML

---
- 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
- 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: run nDPI autogen.sh
command: "./autogen.sh"
args:
chdir: "{{ ansible_user_dir }}/nDPI"
- name: configure nDPI
command: "./configure --with-pic"
args:
chdir: "{{ ansible_user_dir }}/nDPI"
- name: build nDPI
command: "make -j 3"
args:
chdir: "{{ ansible_user_dir }}/nDPI"
- name: run ntopng autogen.sh
command: "./autogen.sh"
args:
chdir: "{{ ansible_user_dir }}/ntopng"
- name: run ntopng configure
command: "./configure"
args:
chdir: "{{ ansible_user_dir }}/ntopng"
- name: build ntopng
command: "make -j 3"
args:
chdir: "{{ ansible_user_dir }}/ntopng"
- name: install
become: yes
command: "make install"
args:
chdir: "{{ ansible_user_dir }}/ntopng"
- name: create ntopng group
become: yes
group:
name: ntopng
state: present
- name: creaate ntopng user
become: yes
user:
name: ntopng
group: ntopng
- name: create directories
become: yes
file:
path: "{{ item }}"
state: directory
owner: ntopng
group: ntopng
with_items:
- /var/nst/ntopng
- /usr/share/ntopng
- /etc/ntopng
- name: copy files
become: yes
copy:
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
tags: test
- name: start ntopng
become: yes
systemd:
name: ntopng.service
state: restarted
enabled: yes
tags: test