You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@metron.apache.org by jo...@apache.org on 2017/12/07 21:22:21 UTC

metron git commit: METRON-1313 Update metron-deployment to use bro-pkg to install the kafka plugin (JonZeolla) closes apache/metron#847

Repository: metron
Updated Branches:
  refs/heads/master 43bbab8f5 -> 2e78df67c


METRON-1313 Update metron-deployment to use bro-pkg to install the kafka plugin (JonZeolla) closes apache/metron#847


Project: http://git-wip-us.apache.org/repos/asf/metron/repo
Commit: http://git-wip-us.apache.org/repos/asf/metron/commit/2e78df67
Tree: http://git-wip-us.apache.org/repos/asf/metron/tree/2e78df67
Diff: http://git-wip-us.apache.org/repos/asf/metron/diff/2e78df67

Branch: refs/heads/master
Commit: 2e78df67c12a6fcad726551128e9753ad36d5ee9
Parents: 43bbab8
Author: JonZeolla <ze...@gmail.com>
Authored: Thu Dec 7 16:21:38 2017 -0500
Committer: jonzeolla <jo...@apache.org>
Committed: Thu Dec 7 16:21:38 2017 -0500

----------------------------------------------------------------------
 .../roles/bro/tasks/dependencies.yml            | 16 +++++-----
 .../roles/bro/tasks/metron-bro-plugin-kafka.yml | 33 ++++++++++----------
 metron-deployment/roles/bro/vars/main.yml       | 10 +++++-
 3 files changed, 32 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/metron/blob/2e78df67/metron-deployment/roles/bro/tasks/dependencies.yml
----------------------------------------------------------------------
diff --git a/metron-deployment/roles/bro/tasks/dependencies.yml b/metron-deployment/roles/bro/tasks/dependencies.yml
index a74557e..3cd3bae 100644
--- a/metron-deployment/roles/bro/tasks/dependencies.yml
+++ b/metron-deployment/roles/bro/tasks/dependencies.yml
@@ -15,6 +15,11 @@
 #  limitations under the License.
 #
 ---
+- name: Install yum repositories
+  yum: name={{ item }} update_cache=yes
+  with_items:
+    - centos-release-scl
+
 - name: Install prerequisites
   yum: name={{ item }}
   with_items:
@@ -33,17 +38,10 @@
     - perl
     - crontabs
     - net-tools
-    - centos-release-scl
-  register: result
-  until: result.rc == 0
-  retries: 5
-  delay: 10
-
-- name: Install additional prerequisites
-  yum: name={{ item }}
-  with_items:
     - devtoolset-4-gcc
     - devtoolset-4-gcc-c++
+    - python27
+    - rh-git29
   register: result
   until: result.rc == 0
   retries: 5

http://git-wip-us.apache.org/repos/asf/metron/blob/2e78df67/metron-deployment/roles/bro/tasks/metron-bro-plugin-kafka.yml
----------------------------------------------------------------------
diff --git a/metron-deployment/roles/bro/tasks/metron-bro-plugin-kafka.yml b/metron-deployment/roles/bro/tasks/metron-bro-plugin-kafka.yml
index f4575b3..7043387 100644
--- a/metron-deployment/roles/bro/tasks/metron-bro-plugin-kafka.yml
+++ b/metron-deployment/roles/bro/tasks/metron-bro-plugin-kafka.yml
@@ -15,36 +15,35 @@
 #  limitations under the License.
 #
 ---
-- name: Clone metron-bro-plugin-kafka into /tmp
-  git:
-    repo: https://github.com/apache/metron-bro-plugin-kafka
-    version: master
-    dest: /tmp/metron-bro-plugin-kafka
+- name: Install bro-pkg
+  environment:
+    LD_LIBRARY_PATH: "{{ python27_lib }}"
+  command: "{{ python27_bin }}/pip install bro-pkg"
+
+- name: Configure bro-pkg
+  environment:
+    PATH: "{{ git29_bin }}:{{ bro_bin }}:{{ ansible_env.PATH }}"
+    LD_LIBRARY_PATH: "{{ python27_lib }}"
+  command: "{{ python27_bin }}/bro-pkg autoconfig"
 
-- name: Compile and install the plugin
-  shell: "{{ item }}"
+- name: Install the metron-bro-plugin-kafka package
   environment:
+    PATH: "{{ git29_bin }}:{{ bro_bin }}:{{ ansible_env.PATH }}"
+    LD_LIBRARY_PATH: "{{ httpd24_lib }}:{{ python27_lib }}"
     CXX: /opt/rh/devtoolset-4/root/usr/bin/g++
     CC: /opt/rh/devtoolset-4/root/usr/bin/gcc
-  args:
-    chdir: "/tmp/metron-bro-plugin-kafka"
-    creates: "{{ bro_home }}/lib/bro/plugins/BRO_KAFKA"
-  with_items:
-    - rm -rf build/
-    - "./configure --bro-dist=/tmp/bro-{{ bro_version }} --install-root={{ bro_home }}/lib/bro/plugins/ --with-librdkafka={{ librdkafka_home }}"
-    - make
-    - make install
+  command: "{{ python27_bin }}/bro-pkg install apache/metron-bro-plugin-kafka --force --version {{ metron_bro_plugin_kafka_version }}"
 
 - name: Configure bro-kafka plugin
   lineinfile:
     dest: "{{ bro_home }}/share/bro/site/local.bro"
     line: "{{ item }}"
   with_items:
-    - "@load Bro/Kafka/logs-to-kafka.bro"
+    - "@load packages"
     - "redef Kafka::logs_to_send = set(HTTP::LOG, DNS::LOG);"
     - "redef Kafka::topic_name = \"{{ bro_topic }}\";"
     - "redef Kafka::tag_json = T;"
     - "redef Kafka::kafka_conf = table([\"metadata.broker.list\"] = \"{{ kafka_broker_url }}\");"
 
 - name: Deploy bro configuration changes
-  shell: "{{ bro_home }}/bin/broctl deploy"
+  shell: "{{ bro_bin }}/broctl deploy"

http://git-wip-us.apache.org/repos/asf/metron/blob/2e78df67/metron-deployment/roles/bro/vars/main.yml
----------------------------------------------------------------------
diff --git a/metron-deployment/roles/bro/vars/main.yml b/metron-deployment/roles/bro/vars/main.yml
index d99a8ef..11d6c31 100644
--- a/metron-deployment/roles/bro/vars/main.yml
+++ b/metron-deployment/roles/bro/vars/main.yml
@@ -16,11 +16,19 @@
 #
 ---
 bro_home: /usr/local/bro
+bro_bin: "{{ bro_home }}/bin"
 bro_version: 2.5.2
 bro_daemon_log: /var/log/bro.log
 bro_topic: bro
 
-# bro cronjob
+# Bro cronjob
 bro_crontab_minutes: 0-59/5
 bro_crontab_job: "{{ bro_home }}/bin/broctl cron"
 bro_clean_job: "rm -rf {{ bro_home }}/spool/tmp/*"
+
+# Bro kafka plugin
+metron_bro_plugin_kafka_version: "0.1"
+python27_bin: /opt/rh/python27/root/usr/bin
+python27_lib: /opt/rh/python27/root/usr/lib64
+git29_bin: /opt/rh/rh-git29/root/usr/bin
+httpd24_lib: /opt/rh/httpd24/root/usr/lib64