From 3ef23484d8a2cf987f8ddfb77b89d38c42d97dcf Mon Sep 17 00:00:00 2001 From: mpelle426 Date: Wed, 24 Jul 2019 15:15:26 +0100 Subject: [PATCH] - ntopng finished for Raspbian 10 --- build.sh | 2 +- roles/ntopng/tasks/main.yaml | 39 ++++++++++++++++++++++++---- roles/ntopng/vars/os_Raspbian_10.yml | 1 + 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/build.sh b/build.sh index 6a2e1dd..d2b2c43 100755 --- a/build.sh +++ b/build.sh @@ -15,7 +15,7 @@ invoke-rc.d ssh start ssh-keygen -t rsa -b 2048 -f ~/.ssh/id_rsa -q -N "" # # -PUBKEY="'$(<~.ssh/id_rsa.pub)'" && ansible-playbook -i hosts deploy_authorized_keys.xml --ask-pass --extra-vars="pubkey=$PUBKEY" +PUBKEY="'$(<~/.ssh/id_rsa.pub)'" && ansible-playbook -i hosts deploy_authorized_keys.yml --ask-pass --extra-vars="pubkey=$PUBKEY" ansible-playbook -i hosts main.yaml --ask-become-pass ansible-playbook -i hosts reboot.yaml reboot diff --git a/roles/ntopng/tasks/main.yaml b/roles/ntopng/tasks/main.yaml index 6866e12..1047106 100644 --- a/roles/ntopng/tasks/main.yaml +++ b/roles/ntopng/tasks/main.yaml @@ -14,12 +14,28 @@ git: repo: https://github.com/ntop/ntopng.git dest: "{{ ansible_user_dir }}/ntopng" -- name: build nDPI - command: "./autogen.sh && ./configure --with-pic && make" +- 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: "./autogen.sh && ./configure && make" + command: "make -j 3" args: chdir: "{{ ansible_user_dir }}/ntopng" - name: install @@ -27,10 +43,20 @@ 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: "{{ items }}" + path: "{{ item }}" state: directory owner: ntopng group: ntopng @@ -39,7 +65,8 @@ - /usr/share/ntopng - /etc/ntopng - name: copy files - template: + become: yes + copy: src: "{{ item.src }}" dest: "{{ item.dest }}" owner: root @@ -52,9 +79,11 @@ become: true systemd: daemon_reload: yes + tags: test - name: start ntopng become: yes systemd: name: ntopng.service state: restarted enabled: yes + tags: test diff --git a/roles/ntopng/vars/os_Raspbian_10.yml b/roles/ntopng/vars/os_Raspbian_10.yml index a076600..e3434c2 100644 --- a/roles/ntopng/vars/os_Raspbian_10.yml +++ b/roles/ntopng/vars/os_Raspbian_10.yml @@ -11,3 +11,4 @@ ntopng_dependency_packages: - libglib2.0-dev - redis - libmaxminddb-dev + - libjson-c-dev