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/03/18 15:36:14 UTC

incubator-metron git commit: METRON-69 EC2 Volume Enhancements (nickwallen via cestella) closes apache/incubator-metron#46

Repository: incubator-metron
Updated Branches:
  refs/heads/master 2b058f2b9 -> c1552937f


METRON-69 EC2 Volume Enhancements (nickwallen via cestella) closes apache/incubator-metron#46


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

Branch: refs/heads/master
Commit: c1552937fa100e607e941297ac842ef2cbb7bf72
Parents: 2b058f2
Author: nickwallen <ni...@nickallen.org>
Authored: Fri Mar 18 10:36:18 2016 -0400
Committer: cstella <ce...@gmail.com>
Committed: Fri Mar 18 10:36:18 2016 -0400

----------------------------------------------------------------------
 deployment/amazon-ec2/conf/defaults.yml       |  5 ++++-
 deployment/amazon-ec2/playbook.yml            |  4 +++-
 deployment/amazon-ec2/tasks/check-volume.yml  | 26 ++++++++++++++++++++++
 deployment/amazon-ec2/tasks/create-hosts.yml  |  6 ++---
 deployment/amazon-ec2/tasks/create-vpc.yml    |  2 +-
 deployment/amazon-ec2/tasks/expand-volume.yml |  9 ++++++--
 6 files changed, 44 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/c1552937/deployment/amazon-ec2/conf/defaults.yml
----------------------------------------------------------------------
diff --git a/deployment/amazon-ec2/conf/defaults.yml b/deployment/amazon-ec2/conf/defaults.yml
index 03557c8..abe96b8 100644
--- a/deployment/amazon-ec2/conf/defaults.yml
+++ b/deployment/amazon-ec2/conf/defaults.yml
@@ -16,12 +16,15 @@
 #
 ---
 # ec2
+env: metron-test
 region: us-west-2
 instance_type: m4.xlarge
 image: ami-05cf2265
 volume_type: standard
 key_name: metron-key
-env: metron-test
+xvda_vol_size: 50
+xvdb_vol_size: 100
+xvdc_vol_size: 100
 
 # ambari
 ambari_host: "{{ groups.ambari_master[0] }}"

http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/c1552937/deployment/amazon-ec2/playbook.yml
----------------------------------------------------------------------
diff --git a/deployment/amazon-ec2/playbook.yml b/deployment/amazon-ec2/playbook.yml
index 6b93edc..d76ac4d 100644
--- a/deployment/amazon-ec2/playbook.yml
+++ b/deployment/amazon-ec2/playbook.yml
@@ -40,10 +40,12 @@
 #
 - hosts: ec2
   become: True
+  vars_files:
+    - conf/defaults.yml
   tasks:
     - include: tasks/mount-volume.yml vol_src=/dev/xvdb vol_mnt=/data1
     - include: tasks/mount-volume.yml vol_src=/dev/xvdc vol_mnt=/data2
-    - include: tasks/expand-volume.yml volume=/dev/xvda
+    - include: tasks/check-volume.yml vol_name=xvda vol_src=/dev/xvda vol_size={{ xvda_vol_size }}
   tags:
     - ec2
 

http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/c1552937/deployment/amazon-ec2/tasks/check-volume.yml
----------------------------------------------------------------------
diff --git a/deployment/amazon-ec2/tasks/check-volume.yml b/deployment/amazon-ec2/tasks/check-volume.yml
new file mode 100644
index 0000000..b7ac63d
--- /dev/null
+++ b/deployment/amazon-ec2/tasks/check-volume.yml
@@ -0,0 +1,26 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You under the Apache License, Version 2.0
+#  (the "License"); you may not use this file except in compliance with
+#  the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+---
+- name: "Check size of volume {{ vol_src }}"
+  shell: "lsblk | grep part | grep {{ vol_name }} | awk '{ print $4}' | sed 's/[^0-9]//g'"
+  register: current_size
+
+- name: "Status of {{ vol_src }} volume"
+  debug: msg="volume={{ vol_src }} current={{ current_size.stdout|int }} expected={{ vol_size|int }}"
+
+- include: expand-volume.yml vol_src={{ vol_src }}
+  when: current_size.stdout|int < vol_size|int

http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/c1552937/deployment/amazon-ec2/tasks/create-hosts.yml
----------------------------------------------------------------------
diff --git a/deployment/amazon-ec2/tasks/create-hosts.yml b/deployment/amazon-ec2/tasks/create-hosts.yml
index 7ebb6d5..bea6b24 100644
--- a/deployment/amazon-ec2/tasks/create-hosts.yml
+++ b/deployment/amazon-ec2/tasks/create-hosts.yml
@@ -35,15 +35,15 @@
     volumes:
     - device_name: /dev/sda1
       volume_type: "{{ volume_type }}"
-      volume_size: 50
+      volume_size: "{{ xvda_vol_size }}"
       delete_on_termination: true
     - device_name: /dev/xvdb
       volume_type: "{{ volume_type }}"
-      volume_size: 100
+      volume_size: "{{ xvdb_vol_size }}"
       delete_on_termination: true
     - device_name: /dev/xvdc
       volume_type: "{{ volume_type }}"
-      volume_size: 100
+      volume_size: "{{ xvdc_vol_size }}"
       delete_on_termination: true
     wait: yes
   register: ec2

http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/c1552937/deployment/amazon-ec2/tasks/create-vpc.yml
----------------------------------------------------------------------
diff --git a/deployment/amazon-ec2/tasks/create-vpc.yml b/deployment/amazon-ec2/tasks/create-vpc.yml
index 12d16dc..7fc31e7 100644
--- a/deployment/amazon-ec2/tasks/create-vpc.yml
+++ b/deployment/amazon-ec2/tasks/create-vpc.yml
@@ -45,6 +45,6 @@
             gw: igw
     register: vpc
 
-  - name: "[{{ env }}] Created vpc with id='{{ vpc.vpc_id }}'"
+  - name: "[{{ env }}] Created vpc with id={{ vpc.vpc_id }}"
     set_fact:
       vpc_id: "{{ vpc.vpc_id }}"

http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/c1552937/deployment/amazon-ec2/tasks/expand-volume.yml
----------------------------------------------------------------------
diff --git a/deployment/amazon-ec2/tasks/expand-volume.yml b/deployment/amazon-ec2/tasks/expand-volume.yml
index 2a80ef5..41cd442 100644
--- a/deployment/amazon-ec2/tasks/expand-volume.yml
+++ b/deployment/amazon-ec2/tasks/expand-volume.yml
@@ -1,3 +1,8 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You under the Apache License, Version 2.0
 #  (the "License"); you may not use this file except in compliance with
 #  the License.  You may obtain a copy of the License at
 #
@@ -10,9 +15,9 @@
 #  limitations under the License.
 #
 ---
-- name: Expand {{ volume }} volume
+- name: "Expand {{ vol_src }} volume"
 #          sectors  delete 1  new      primary  first    past mbr to end  bootable     write and exit
-  shell: "(echo u s; echo d 1; echo n; echo p; echo 1; echo 2048 ; echo ;echo a; echo 1; echo w) | fdisk {{ volume }} || true"
+  shell: "(echo u s; echo d 1; echo n; echo p; echo 1; echo 2048 ; echo ;echo a; echo 1; echo w) | fdisk {{ vol_src }} || true"
   args:
     executable: /bin/bash