You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@metron.apache.org by ce...@apache.org on 2016/01/29 21:04:27 UTC
[14/30] incubator-metron git commit: Moved hadoop setup tasks to
separate role and updated documentation
Moved hadoop setup tasks to separate role and updated documentation
Project: http://git-wip-us.apache.org/repos/asf/incubator-metron/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-metron/commit/ab77fc29
Tree: http://git-wip-us.apache.org/repos/asf/incubator-metron/tree/ab77fc29
Diff: http://git-wip-us.apache.org/repos/asf/incubator-metron/diff/ab77fc29
Branch: refs/heads/master
Commit: ab77fc2917949abb7a4a19f8dbb8f0da4f616d82
Parents: d8ef56e
Author: rmerriman <rm...@hortonworks.com>
Authored: Mon Jan 25 14:12:39 2016 -0600
Committer: rmerriman <rm...@hortonworks.com>
Committed: Tue Jan 26 09:58:18 2016 -0600
----------------------------------------------------------------------
deployment/README.md | 109 +++++++++++----
.../inventory/metron_example/group_vars/all | 14 +-
deployment/inventory/metron_example/hosts | 17 ++-
.../inventory/singlenode-vagrant/group_vars/all | 16 ++-
deployment/inventory/singlenode-vagrant/hosts | 5 +-
deployment/playbooks/metron_install.yml | 6 +
.../roles/ambari_config/vars/single_node_vm.yml | 1 +
deployment/roles/hadoop_setup/defaults/main.yml | 2 +
deployment/roles/hadoop_setup/handlers/main.yml | 2 +
deployment/roles/hadoop_setup/meta/main.yml | 139 +++++++++++++++++++
deployment/roles/hadoop_setup/tasks/main.yml | 10 ++
deployment/roles/hadoop_setup/vars/main.yml | 2 +
.../roles/metron_pcapservice/tasks/main.yml | 9 +-
.../roles/metron_pcapservice/vars/main.yml | 2 +-
.../roles/metron_streaming/tasks/main.yml | 53 ++-----
deployment/roles/metron_streaming/vars/main.yml | 8 +-
deployment/roles/metron_ui/tasks/main.yml | 1 +
17 files changed, 299 insertions(+), 97 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/ab77fc29/deployment/README.md
----------------------------------------------------------------------
diff --git a/deployment/README.md b/deployment/README.md
index fadb471..84b9e0a 100644
--- a/deployment/README.md
+++ b/deployment/README.md
@@ -1,48 +1,97 @@
# Overview
-This set of playbooks will deploy the full Metron stack using ansible
+This set of playbooks can be used to deploy an Ambari-managed Hadoop cluster, Metron services, or both using ansible
playbooks. These playbooks currently only target RHEL/CentOS 6.x operating
systems.
-## Setting up your inventory
-Make sure to update the hosts file in `inventory/hosts` or provide an
+## Prerequisites
+The following tools are required to run these scripts:
+
+- Maven - https://maven.apache.org/
+- Git - https://git-scm.com/
+- Ansible - http://www.ansible.com/ (version 2.0 or greater)
+
+Currently Metron must be built from source. Before running these scripts perform the following steps:
+
+1. Clone the Metron git repository with `git clone git@github.com:apache/incubator-metron.git`
+2. Navigate to `incubator-metron/metron-streaming` and run `mvn clean package`
+
+These scripts depend on two files for configuration:
+
+- hosts - declares which Ansible roles will be run on which hosts
+- group_vars/all - various configuration settings needed to install Metron
+
+Examples can be found in the
+`incubator-metron/deployment/inventory/metron_example` directory and are a good starting point. Copy this directory
+into `incubator-metron/deployment/inventory/` and rename it to your `project_name`. More information about Ansible files and directory
+structure can be found at http://docs.ansible.com/ansible/playbooks_best_practices.html.
+
+## Ambari
+The Ambari playbook will install a Hadoop cluster with all the services and configuration required by Metron. This
+section can be skipped if installing Metron on a pre-existing cluster.
+
+Currently, this playbook supports building a local development cluster running on one node but options for other types
+ of clusters will be added in the future.
+
+### Setting up your inventory
+Make sure to update the hosts file in `incubator-metron/deployment/inventory/project_name/hosts` or provide an
alternate inventory file when you launch the playbooks, including the
-ssh user(s) and ssh keyfile location(s). These playbooks expect three
+ssh user(s) and ssh keyfile location(s). These playbooks expect two
host groups:
- ambari_master
-- hadoop_master
-- hadoop_slaves
+- ambari_slaves
+
+### Running the playbook
+This playbook will install the Ambari server on the ambari_master, install the ambari agents on
+the ambari_slaves, and create a cluster in Ambari with a blueprint for the required
+Metron components.
+
+Navigate to `incubator-metron/deployment/playbooks` and run:
+`ansible-playbook -i ../inventory/project_name ambari_install.yml`
+
+## Metron
+The Metron playbook will gather the necessary cluster settings from Ambari and install the Metron services.
+
+### Setting up your inventory
+Edit the hosts file at `incubator-metron/deployment/inventory/project_name/hosts`. Declare where which hosts the
+Metron services will be installed on by updating these groups:
+
+- enrichment - submits the topology code to Storm and requires a storm client
+- search - host where Elasticsearch will be run
+- web - host where the Metron UI and underlying services will run
+- sensors - host where network data will be collected and published to Kafka
+
+The Metron topologies depend on Kafka topics and HBase tables being created beforehand. Declare a host that has Kafka
+ and HBase clients installed by updating this group:
+
+- hadoop_client
+
+If only installing Metron, these groups can be ignored:
+
+- ambari_master
+- ambari_slaves
-## Running the playbooks
-#### Ambari Install:
-This will install the Ambari server on one machine the ambari agent on
-the hadoop master/slaves.
+### Configuring group variables
+The Metron Ansible scripts depend on a set of variables. These variables can be found in the file at
+`incubator-metron/deployment/inventory/project_name/group_vars/all`. Edit the ambari* variables to match your Ambari
+instance and update the java_home variable to match the java path on your hosts.
-Run this playbook with: `ansible-playbook ambari_install.yml`
+### Running the playbook
+Navigate to `incubator-metron/deployment/playbooks` and run:
+`ansible-playbook -i ../inventory/project_name metron_install.yml`
-Some of the code for installing/configuring Ambari comes from here:
-https://github.com/seanorama/ansible-ambari
+## Vagrant
+A VagrantFile is included and will install a working version of the entire Metron stack. The following is required to
+run this:
-#### Ambari Config:
-This will create a cluster in Ambari with a blueprint for the required
-Metron components. This uses a custom ansible module for managing Ambari
-clusters using a yaml configuration. The cluster blueprint is defined in
-this file: `roles/ambari_config/vars/main.yml`
+- Vagrant - https://www.vagrantup.com/
+- Hostmanager plugin for vagrant - Run `vagrant install plugin vagrant-hostmanager` on the machine where Vagrant is
+installed
-To create a Metron cluster in Ambari, run this playbook with the command:
-`ansible-playbook ambari_config.yml --tags "create_cluster"`
+Navigate to `incubator-metron/deployment/vagrant/singlenode-vagrant` and run `vagrant up`. This also provides a good
+example of how to run a full end-to-end Metron install.
-To delete a Metron cluster in Ambari, run this playbook with the command:
-`ansible-playbook ambari_config.yml --tags "delete_cluster"`
-*NOTE: The bug reported in [AMBARI-13906](https://issues.apache.org/jira/browse/AMBARI-13906)
-prevents cluster delete via the API. To remove the cluster, you must perform
-a hard reset of the ambari server to delete the cluster.*
## TODO
-- Automatically create and populate HBase tables from files
-- migrate existing elasticsearch playbook
-- migrate existing OpenSOC UI playbook
- migrate existing MySQL/GeoLite playbook
-- migrate existing OpenSOC Storm client playbook
-- Update all playbooks to baseline Metron version
- Support Ubuntu deployments
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/ab77fc29/deployment/inventory/metron_example/group_vars/all
----------------------------------------------------------------------
diff --git a/deployment/inventory/metron_example/group_vars/all b/deployment/inventory/metron_example/group_vars/all
index 3ecfe61..12cad5e 100644
--- a/deployment/inventory/metron_example/group_vars/all
+++ b/deployment/inventory/metron_example/group_vars/all
@@ -5,14 +5,18 @@ ambari_user: "admin"
ambari_password: "admin"
#Metron variables
-elasticsearch_ip: "metron07.cloud.hortonworks.com"
-elasticsearch_web_port: 9200
-elasticsearch_transport_port: 9300
-elasticsearch_cluster_name: "metron"
-pcapservice_host: "metron07.cloud.hortonworks.com"
+metron_version: 0.6BETA
+java_home: "/usr/jdk64/jdk1.8.0_40"
#Default values
hdp_repo_def: "http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.3.2.0/hdp.repo"
+hbase_config_path: "/etc/hbase/conf"
+kafka_home: "/usr/hdp/current/kafka-broker/"
+elasticsearch_config_path: "/etc/elasticsearch"
+elasticsearch_cluster_name: "metron"
+elasticsearch_web_port: 9200
+elasticsearch_transport_port: 9300
+pcapservice_port: 8081
bro_version: "2.4.1"
fixbuf_version: "1.7.1"
yaf_version: "2.8.0"
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/ab77fc29/deployment/inventory/metron_example/hosts
----------------------------------------------------------------------
diff --git a/deployment/inventory/metron_example/hosts b/deployment/inventory/metron_example/hosts
index f399a2b..92160bc 100644
--- a/deployment/inventory/metron_example/hosts
+++ b/deployment/inventory/metron_example/hosts
@@ -1,11 +1,20 @@
+[ambari_master]
+host
+
+[ambari_slave]
+host
+
+[hadoop_client]
+host
+
[enrichment]
-metron07.cloud.hortonworks.com ansible_ssh_private_key_file=/Users/rmerriman/Projects/Metron/AWS/secloud/cluster_key.txt ansible_ssh_user=root
+host ansible_ssh_private_key_file=path_to_key_file ansible_ssh_user=user
[search]
-metron07.cloud.hortonworks.com ansible_ssh_private_key_file=/Users/rmerriman/Projects/Metron/AWS/secloud/cluster_key.txt ansible_ssh_pass=vagrant ansible_ssh_user=root
+host ansible_ssh_private_key_file=path_to_key_file ansible_ssh_user=user
[web]
-metron07.cloud.hortonworks.com ansible_ssh_private_key_file=/Users/rmerriman/Projects/Metron/AWS/secloud/cluster_key.txt ansible_ssh_pass=vagrant ansible_ssh_user=root
+host ansible_ssh_private_key_file=path_to_key_file ansible_ssh_user=user
[sensors]
-metron07.cloud.hortonworks.com ansible_ssh_private_key_file=/Users/rmerriman/Projects/Metron/AWS/secloud/cluster_key.txt ansible_ssh_pass=vagrant ansible_ssh_user=root
\ No newline at end of file
+host ansible_ssh_private_key_file=path_to_key_file ansible_ssh_user=user
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/ab77fc29/deployment/inventory/singlenode-vagrant/group_vars/all
----------------------------------------------------------------------
diff --git a/deployment/inventory/singlenode-vagrant/group_vars/all b/deployment/inventory/singlenode-vagrant/group_vars/all
index cf78381..3823034 100644
--- a/deployment/inventory/singlenode-vagrant/group_vars/all
+++ b/deployment/inventory/singlenode-vagrant/group_vars/all
@@ -3,19 +3,22 @@ ambari_host: "node1"
ambari_port: 8080
ambari_user: "admin"
ambari_password: "admin"
-cluster_name: "metron_cluster"
cluster_type: "single_node_vm"
hdp_host_group: ["node1"]
#Metron variables
-elasticsearch_ip: "192.168.66.121"
-elasticsearch_web_port: 9200
-elasticsearch_transport_port: 9300
-elasticsearch_cluster_name: "metron"
-pcapservice_host: "node1"
+metron_version: 0.6BETA
+java_home: "/usr/jdk64/jdk1.8.0_40"
#Default values
hdp_repo_def: "http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.3.2.0/hdp.repo"
+hbase_config_path: "/etc/hbase/conf"
+kafka_home: "/usr/hdp/current/kafka-broker/"
+elasticsearch_config_path: "/etc/elasticsearch"
+elasticsearch_cluster_name: "metron"
+elasticsearch_web_port: 9200
+elasticsearch_transport_port: 9300
+pcapservice_port: 8081
bro_version: "2.4.1"
fixbuf_version: "1.7.1"
yaf_version: "2.8.0"
@@ -25,6 +28,7 @@ iface: "eth0"
yaf_topic: "ipfix"
snort_topic: "snort"
bro_topic: "bro"
+pcap_hbase_table: "pcap_test"
pycapa_repo: "https://github.com/OpenSOC/pycapa.git"
pycapa_home: "/opt/pycapa"
pycapa_topic: "pcap"
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/ab77fc29/deployment/inventory/singlenode-vagrant/hosts
----------------------------------------------------------------------
diff --git a/deployment/inventory/singlenode-vagrant/hosts b/deployment/inventory/singlenode-vagrant/hosts
index e46577c..379bdd7 100644
--- a/deployment/inventory/singlenode-vagrant/hosts
+++ b/deployment/inventory/singlenode-vagrant/hosts
@@ -4,6 +4,9 @@ node1
[ambari_slave]
node1
+[hadoop_client]
+node1
+
[enrichment]
node1
@@ -14,4 +17,4 @@ node1
node1
[sensors]
-node1
+node1
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/ab77fc29/deployment/playbooks/metron_install.yml
----------------------------------------------------------------------
diff --git a/deployment/playbooks/metron_install.yml b/deployment/playbooks/metron_install.yml
index 07364b4..1c9ac54 100644
--- a/deployment/playbooks/metron_install.yml
+++ b/deployment/playbooks/metron_install.yml
@@ -1,4 +1,10 @@
---
+- hosts: hadoop_client
+ sudo: yes
+ roles:
+ - role: ambari_gather_facts
+ - role: hadoop_setup
+
- hosts: search
sudo: yes
roles:
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/ab77fc29/deployment/roles/ambari_config/vars/single_node_vm.yml
----------------------------------------------------------------------
diff --git a/deployment/roles/ambari_config/vars/single_node_vm.yml b/deployment/roles/ambari_config/vars/single_node_vm.yml
index 010903b..d26be12 100644
--- a/deployment/roles/ambari_config/vars/single_node_vm.yml
+++ b/deployment/roles/ambari_config/vars/single_node_vm.yml
@@ -16,6 +16,7 @@ hbase_slave: [HBASE_REGIONSERVER]
metron_components: "{{ hadoop_master | union(zookeeper_master) | union(storm_master) | union(spark_master) | union(ganglia_master) | union(hbase_master) | union(hadoop_slave) | union(zookeeper_slave) | union(storm_slave) | union(spark_slave) | union(kafka_broker) | union(hbase_slave) }}"
+cluster_name: "metron_cluster"
blueprint_name: "metron_blueprint"
configurations:
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/ab77fc29/deployment/roles/hadoop_setup/defaults/main.yml
----------------------------------------------------------------------
diff --git a/deployment/roles/hadoop_setup/defaults/main.yml b/deployment/roles/hadoop_setup/defaults/main.yml
new file mode 100644
index 0000000..0c25535
--- /dev/null
+++ b/deployment/roles/hadoop_setup/defaults/main.yml
@@ -0,0 +1,2 @@
+---
+# defaults file for hadoop_setup
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/ab77fc29/deployment/roles/hadoop_setup/handlers/main.yml
----------------------------------------------------------------------
diff --git a/deployment/roles/hadoop_setup/handlers/main.yml b/deployment/roles/hadoop_setup/handlers/main.yml
new file mode 100644
index 0000000..fc19806
--- /dev/null
+++ b/deployment/roles/hadoop_setup/handlers/main.yml
@@ -0,0 +1,2 @@
+---
+# handlers file for hadoop_setup
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/ab77fc29/deployment/roles/hadoop_setup/meta/main.yml
----------------------------------------------------------------------
diff --git a/deployment/roles/hadoop_setup/meta/main.yml b/deployment/roles/hadoop_setup/meta/main.yml
new file mode 100644
index 0000000..62c7d35
--- /dev/null
+++ b/deployment/roles/hadoop_setup/meta/main.yml
@@ -0,0 +1,139 @@
+---
+galaxy_info:
+ author: your name
+ description:
+ company: your company (optional)
+ # If the issue tracker for your role is not on github, uncomment the
+ # next line and provide a value
+ # issue_tracker_url: http://example.com/issue/tracker
+ # Some suggested licenses:
+ # - BSD (default)
+ # - MIT
+ # - GPLv2
+ # - GPLv3
+ # - Apache
+ # - CC-BY
+ license: license (GPLv2, CC-BY, etc)
+ min_ansible_version: 1.2
+ #
+ # Below are all platforms currently available. Just uncomment
+ # the ones that apply to your role. If you don't see your
+ # platform on this list, let us know and we'll get it added!
+ #
+ #platforms:
+ #- name: EL
+ # versions:
+ # - all
+ # - 5
+ # - 6
+ # - 7
+ #- name: GenericUNIX
+ # versions:
+ # - all
+ # - any
+ #- name: Fedora
+ # versions:
+ # - all
+ # - 16
+ # - 17
+ # - 18
+ # - 19
+ # - 20
+ # - 21
+ # - 22
+ #- name: Windows
+ # versions:
+ # - all
+ # - 2012R2
+ #- name: SmartOS
+ # versions:
+ # - all
+ # - any
+ #- name: opensuse
+ # versions:
+ # - all
+ # - 12.1
+ # - 12.2
+ # - 12.3
+ # - 13.1
+ # - 13.2
+ #- name: Amazon
+ # versions:
+ # - all
+ # - 2013.03
+ # - 2013.09
+ #- name: GenericBSD
+ # versions:
+ # - all
+ # - any
+ #- name: FreeBSD
+ # versions:
+ # - all
+ # - 8.0
+ # - 8.1
+ # - 8.2
+ # - 8.3
+ # - 8.4
+ # - 9.0
+ # - 9.1
+ # - 9.1
+ # - 9.2
+ #- name: Ubuntu
+ # versions:
+ # - all
+ # - lucid
+ # - maverick
+ # - natty
+ # - oneiric
+ # - precise
+ # - quantal
+ # - raring
+ # - saucy
+ # - trusty
+ # - utopic
+ # - vivid
+ #- name: SLES
+ # versions:
+ # - all
+ # - 10SP3
+ # - 10SP4
+ # - 11
+ # - 11SP1
+ # - 11SP2
+ # - 11SP3
+ #- name: GenericLinux
+ # versions:
+ # - all
+ # - any
+ #- name: Debian
+ # versions:
+ # - all
+ # - etch
+ # - jessie
+ # - lenny
+ # - squeeze
+ # - wheezy
+ #
+ # Below are all categories currently available. Just as with
+ # the platforms above, uncomment those that apply to your role.
+ #
+ #categories:
+ #- cloud
+ #- cloud:ec2
+ #- cloud:gce
+ #- cloud:rax
+ #- clustering
+ #- database
+ #- database:nosql
+ #- database:sql
+ #- development
+ #- monitoring
+ #- networking
+ #- packaging
+ #- system
+ #- web
+dependencies: []
+ # List your role dependencies here, one per line.
+ # Be sure to remove the '[]' above if you add dependencies
+ # to this list.
+
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/ab77fc29/deployment/roles/hadoop_setup/tasks/main.yml
----------------------------------------------------------------------
diff --git a/deployment/roles/hadoop_setup/tasks/main.yml b/deployment/roles/hadoop_setup/tasks/main.yml
new file mode 100644
index 0000000..2e240e8
--- /dev/null
+++ b/deployment/roles/hadoop_setup/tasks/main.yml
@@ -0,0 +1,10 @@
+---
+- name: Create HBase tables
+ shell: echo "create '{{ pcap_hbase_table }}','t'" | hbase shell -n
+ ignore_errors: yes
+
+- name: Create Kafka topics
+ shell: "{{ kafka_home }}/bin/kafka-topics.sh --zookeeper {{ zookeeper_url }} --create --topic {{ item }} --partitions 1 --replication-factor 1"
+ ignore_errors: yes
+ with_items:
+ - "{{ pycapa_topic }}"
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/ab77fc29/deployment/roles/hadoop_setup/vars/main.yml
----------------------------------------------------------------------
diff --git a/deployment/roles/hadoop_setup/vars/main.yml b/deployment/roles/hadoop_setup/vars/main.yml
new file mode 100644
index 0000000..40acd3f
--- /dev/null
+++ b/deployment/roles/hadoop_setup/vars/main.yml
@@ -0,0 +1,2 @@
+---
+# vars file for hadoop_setup
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/ab77fc29/deployment/roles/metron_pcapservice/tasks/main.yml
----------------------------------------------------------------------
diff --git a/deployment/roles/metron_pcapservice/tasks/main.yml b/deployment/roles/metron_pcapservice/tasks/main.yml
index 060340a..734dcd9 100644
--- a/deployment/roles/metron_pcapservice/tasks/main.yml
+++ b/deployment/roles/metron_pcapservice/tasks/main.yml
@@ -1,18 +1,11 @@
---
# tasks file for metron_pcapservice
-
-- set_fact:
- pcapservice_jar_path: "{{ playbook_dir }}/../../metron-streaming/Metron-Pcap_Service/target/{{ pcapservice_jar_name }}"
-
- name: Create Metron streaming directories
file: path={{ metron_directory }}/{{ item.name }} state=directory mode=0755
with_items:
- { name: 'lib'}
- { name: 'config'}
-#- name: Dowloand Metron topology code
-# get_url: url={{ pcapservice_jar_url }} dest={{ metron_directory }}/lib/
-
- name: Copy Metron pcapservice jar
copy:
src: "{{ pcapservice_jar_path }}"
@@ -31,7 +24,7 @@
yum: name=daemonize state=latest
- name: Start pcap_service
- shell: "daemonize -c {{ metron_directory }} -e /var/log/metron_pcapservice.log -o /var/log/metron_pcapservice.log -l /var/lock/subsys/metron_pcapservice /usr/bin/java -cp {{ metron_directory }}/lib/{{ pcapservice_jar_name }} com.opensoc.pcapservice.rest.PcapService"
+ shell: "daemonize -c {{ metron_directory }} -e /var/log/metron_pcapservice.log -o /var/log/metron_pcapservice.log -l /var/lock/subsys/metron_pcapservice /usr/bin/java -cp {{ metron_directory }}/lib/{{ pcapservice_jar_name }} com.opensoc.pcapservice.rest.PcapService -p {{ pcapservice_port }}"
args:
creates: /var/lock/subsys/metron_pcapservice
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/ab77fc29/deployment/roles/metron_pcapservice/vars/main.yml
----------------------------------------------------------------------
diff --git a/deployment/roles/metron_pcapservice/vars/main.yml b/deployment/roles/metron_pcapservice/vars/main.yml
index d129a49..38510a3 100644
--- a/deployment/roles/metron_pcapservice/vars/main.yml
+++ b/deployment/roles/metron_pcapservice/vars/main.yml
@@ -3,4 +3,4 @@
metron_version: 0.6BETA
metron_directory: /usr/metron/{{ metron_version }}
pcapservice_jar_name: Metron-Pcap_Service-{{ metron_version }}-jar-with-dependencies.jar
-pcapservice_jar_url: http://{{ pcapservice_host }}:8080/repository/internal/com/opensoc/OpenSOC-Pcap_Service/{{ metron_version }}/{{ pcapservice_jar_name }}
+pcapservice_jar_path: "{{ playbook_dir }}/../../metron-streaming/Metron-Pcap_Service/target/{{ pcapservice_jar_name }}"
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/ab77fc29/deployment/roles/metron_streaming/tasks/main.yml
----------------------------------------------------------------------
diff --git a/deployment/roles/metron_streaming/tasks/main.yml b/deployment/roles/metron_streaming/tasks/main.yml
index f32df66..8c41aa1 100644
--- a/deployment/roles/metron_streaming/tasks/main.yml
+++ b/deployment/roles/metron_streaming/tasks/main.yml
@@ -1,15 +1,4 @@
---
-- set_fact:
- metron_jar_path: "{{ playbook_dir }}/../../metron-streaming/Metron-Topologies/target/{{ metron_jar_name }}"
-
-# - name: Build Metron streaming
-# shell: "{{ item }}"
-# args:
-# chdir: "{{ playbook_dir }}../../../opensoc-streaming"
-# creates: "{{ metron_jar_path }}"
-# with_items:
-# - mvn package
-
- name: Create Metron streaming directories
file: path="{{ metron_directory }}/{{ item.name }}" state=directory mode=0755
with_items:
@@ -24,53 +13,41 @@
- name: Alternatives link for "java"
alternatives: name={{ item.name }} link={{ item.link }} path={{ item.path }}
with_items:
- - { name: java, link: /usr/bin/java, path: /usr/jdk64/jdk1.8.0_40/bin/java}
- - { name: jar, link: /usr/bin/jar, path: /usr/jdk64/jdk1.8.0_40/bin/jar}
+ - { name: java, link: /usr/bin/java, path: "{{ java_home }}/bin/java" }
+ - { name: jar, link: /usr/bin/jar, path: "{{ java_home }}/bin/jar" }
- name: Add hbase-site.xml to topology jar
- shell: cd /etc/hbase/conf/ && jar -uf {{ metron_directory }}/lib/{{ metron_jar_name }} hbase-site.xml
+ shell: cd {{ hbase_config_path }} && jar -uf {{ metron_directory }}/lib/{{ metron_jar_name }} hbase-site.xml
- name: Add elasticsearch.ym to topology jar
- shell: cd /etc/elasticsearch && jar -uf {{ metron_directory }}/lib/{{ metron_jar_name }} elasticsearch.yml
-
-- name: Download Metron topology config templates
- get_url: url={{ metron_source_url }} dest=/tmp/metron_source.zip
-
-- name: Unpack Metron source
- unarchive: src=/tmp/metron_source.zip dest=/tmp copy=no
+ shell: cd {{ elasticsearch_config_path }} && jar -uf {{ metron_directory }}/lib/{{ metron_jar_name }} elasticsearch.yml
-- name: Copy unpacked environment configs to config directory
- command: cp -r /tmp/incubator-metron-{{ metron_branch }}/metron-streaming/Metron-Topologies/src/main/resources/Metron_Configs/etc {{ metron_directory }}/config
-
-- name: Copy unpacked topology configs to config directory
- command: cp -r /tmp/incubator-metron-{{ metron_branch }}/metron-streaming/Metron-Topologies/src/main/resources/Metron_Configs/topologies {{ metron_directory }}/config
-
-- name: Cleanup unpacked topology configs
- file:
- path: "{{ item }}"
- state: absent
+- name: Copy Metron topology config files
+ copy:
+ src: "{{ metron_src_config_path }}/{{ item }}"
+ dest: "{{ metron_directory }}/config/"
with_items:
- - "/tmp/metron_source.zip"
- - "/tmp/incubator-metron-{{ metron_branch }}"
+ - "etc"
+ - "topologies"
- name: Configure config.properties
lineinfile: >
- dest={{ metron_directory }}/config/etc/env/config.properties
+ dest={{ metron_properties_config_path }}
regexp="{{ item.regexp }}"
line="{{ item.line }}"
state=present
with_items:
- { regexp: "kafka.zk=", line: "kafka.zk={{ zookeeper_url }}" }
- - { regexp: "spout.kafka.topic.pcap=", line: "spout.kafka.topic.pcap={{ pycapa_topic }}" }
- - { regexp: "es.ip=", line: "es.ip={{ elasticsearch_ip }}" }
+ - { regexp: "spout.kafka.topic=", line: "spout.kafka.topic={{ pycapa_topic }}" }
+ - { regexp: "es.ip=", line: "es.ip={{ groups.search[0] }}" }
- { regexp: "es.port=", line: "es.port={{ elasticsearch_transport_port }}" }
- { regexp: "es.clustername=", line: "es.clustername={{ elasticsearch_cluster_name }}" }
- { regexp: "bolt.hdfs.file.system.url=", line: "bolt.hdfs.file.system.url={{ hdfs_url }}" }
- name: Create HBase tables
- shell: echo "create 'pcap_test','t'" | hbase shell -n
+ shell: echo "create '{{ pcap_hbase_table }}','t'" | hbase shell -n
ignore_errors: yes
- name: Submit Pcap topology
- command: storm jar {{ metron_directory }}/lib/{{ metron_jar_name }} org.apache.storm.flux.Flux --remote {{ metron_directory }}/config/topologies/pcap/remote.yaml --filter {{ metron_directory }}/config/etc/env/config.properties
+ command: storm jar {{ metron_directory }}/lib/{{ metron_jar_name }} org.apache.storm.flux.Flux --remote {{ metron_pcap_topology_config_path }} --filter {{ metron_properties_config_path }}
ignore_errors: yes
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/ab77fc29/deployment/roles/metron_streaming/vars/main.yml
----------------------------------------------------------------------
diff --git a/deployment/roles/metron_streaming/vars/main.yml b/deployment/roles/metron_streaming/vars/main.yml
index fa77ea4..e3f5f38 100644
--- a/deployment/roles/metron_streaming/vars/main.yml
+++ b/deployment/roles/metron_streaming/vars/main.yml
@@ -1,8 +1,8 @@
---
# vars file for elasticsearch
-metron_version: 0.6BETA
metron_directory: /usr/metron/{{ metron_version }}
metron_jar_name: Metron-Topologies-{{ metron_version }}.jar
-metron_jar_url: http://52.90.121.195:8080/repository/internal/com/opensoc/OpenSOC-Topologies/{{ metron_version }}/{{ metron_jar_name }}
-metron_branch: topic_per_source
-metron_source_url: https://github.com/merrimanr/incubator-metron/archive/{{ metron_branch }}.zip
+metron_jar_path: "{{ playbook_dir }}/../../metron-streaming/Metron-Topologies/target/{{ metron_jar_name }}"
+metron_src_config_path: "{{ playbook_dir }}/../../metron-streaming/Metron-Topologies/src/main/resources/Metron_Configs"
+metron_properties_config_path: "{{ metron_directory }}/config/etc/env/config.properties"
+metron_pcap_topology_config_path: "{{ metron_directory }}/config/topologies/pcap/remote.yaml"
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/ab77fc29/deployment/roles/metron_ui/tasks/main.yml
----------------------------------------------------------------------
diff --git a/deployment/roles/metron_ui/tasks/main.yml b/deployment/roles/metron_ui/tasks/main.yml
index 3a4372c..635bc66 100644
--- a/deployment/roles/metron_ui/tasks/main.yml
+++ b/deployment/roles/metron_ui/tasks/main.yml
@@ -34,6 +34,7 @@
state=present
with_items:
- { regexp: '"elasticsearch":', line: '" elasticsearch": { "url": "http://{{ groups.search[0] }}:{{ elasticsearch_web_port }}" },' }
+ - { regexp: '"pcap":', line: ' "pcap": { "url": "http://{{ groups.web[0] }}:{{ pcapservice_port }}/pcap/pcapGetter","mock": false }' }
- name: Fix pcap_all error
replace: