--- - name: check if nDPI exists stat: path: "{{ ansible_user_dir }}/nDPI/src/lib/libndpi.so.2.9.0" register: nDPI_installed - name: check if ntopng built stat: path: "{{ ansible_user_dir }}/ntopng/ntopng" register: ntopng_built - name: check if ntopng installed stat: path: "/usr/local/bin/ntopng" register: ntopng_installed - 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" when: nDPI_installed.stat.exists == false - name: clone ntopng git: repo: https://github.com/ntop/ntopng.git dest: "{{ ansible_user_dir }}/ntopng" when: ntopng_built.stat.exists == false - name: run nDPI autogen.sh command: "./autogen.sh" args: chdir: "{{ ansible_user_dir }}/nDPI" when: nDPI_installed.stat.exists == false - name: configure nDPI command: "./configure --with-pic" args: chdir: "{{ ansible_user_dir }}/nDPI" when: nDPI_installed.stat.exists == false - name: build nDPI command: "make -j 3" args: chdir: "{{ ansible_user_dir }}/nDPI" when: nDPI_installed.stat.exists == false - name: run ntopng autogen.sh command: "./autogen.sh" args: chdir: "{{ ansible_user_dir }}/ntopng" when: ntopng_built.stat.exists == false - name: run ntopng configure command: "./configure" args: chdir: "{{ ansible_user_dir }}/ntopng" when: ntopng_built.stat.exists == false - name: build ntopng command: "make -j 3" args: chdir: "{{ ansible_user_dir }}/ntopng" when: ntopng_built.stat.exists == false - name: install become: yes command: "make install" args: chdir: "{{ ansible_user_dir }}/ntopng" when: ntopng_installed.stat.exists == false tags: test - name: create ntopng group become: yes group: name: ntopng state: present tags: test - name: creaate ntopng user become: yes user: name: ntopng group: ntopng tags: test - name: create directories become: yes file: path: "{{ item }}" state: directory owner: ntopng group: ntopng with_items: - /var/nst/ntopng - /usr/share/ntopng - /etc/ntopng tags: test - 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" } tags: test - 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