From 2853c545908872fd2f13a5ad36f8e52bdfb3a02f Mon Sep 17 00:00:00 2001 From: Sergey Reshetnyak Date: Sun, 10 May 2015 16:55:55 +0300 Subject: [PATCH] [HDP2] Add ambari element New version of HDP plugin uses this element for installing Ambari partially implements bp: hdp-22-support Change-Id: Icdbd1832fb0f1a64a0a41dd67b840f0d2a38b8b0 --- diskimage-create/README.rst | 4 +- diskimage-create/diskimage-create.sh | 48 +++++++++++++++++++ elements/ambari/README.rst | 14 ++++++ elements/ambari/element-deps | 3 ++ elements/ambari/package-installs.yaml | 7 +++ .../ambari/post-install.d/10-disable-ambari | 14 ++++++ .../ambari/pre-install.d/90-ambari-repo-conf | 22 +++++++++ 7 files changed, 110 insertions(+), 2 deletions(-) create mode 100644 elements/ambari/README.rst create mode 100644 elements/ambari/element-deps create mode 100644 elements/ambari/package-installs.yaml create mode 100755 elements/ambari/post-install.d/10-disable-ambari create mode 100755 elements/ambari/pre-install.d/90-ambari-repo-conf diff --git a/diskimage-create/README.rst b/diskimage-create/README.rst index 0a55b51f..3f61d001 100644 --- a/diskimage-create/README.rst +++ b/diskimage-create/README.rst @@ -27,7 +27,7 @@ NOTE: Do not create all images for all plugins with the same mirrors. Different .. sourcecode:: bash - tox -e venv -- sahara-image-create -p [vanilla|spark|hdp|cloudera|storm|mapr] + tox -e venv -- sahara-image-create -p [vanilla|spark|hdp|cloudera|storm|mapr|ambari] 5. To select which hadoop version to target use the '-v' commandline option like this: @@ -39,7 +39,7 @@ NOTE: Do not create all images for all plugins with the same mirrors. Different .. sourcecode:: bash - tox -e venv -- sahara-image-create -i [ubuntu|fedora|centos] + tox -e venv -- sahara-image-create -i [ubuntu|fedora|centos|centos7] 7. If the host system is missing packages required for diskimage-create.sh, the '-u' commandline option will instruct the script to install them without prompt. diff --git a/diskimage-create/diskimage-create.sh b/diskimage-create/diskimage-create.sh index 10e8c299..97ed1cee 100755 --- a/diskimage-create/diskimage-create.sh +++ b/diskimage-create/diskimage-create.sh @@ -227,6 +227,16 @@ case "$PLUGIN" in ;; esac ;; + "ambari") + case "$BASE_IMAGE_OS" in + "" | "centos" | "centos7" | "ubuntu" ) + ;; + * ) + echo "\"$BASE_IMAGE_OS\" image type is not supported by \"$PLUGIN\".\nAborting" + exit 1 + ;; + esac + ;; "mapr") case "$BASE_IMAGE_OS" in "" | "ubuntu" | "centos");; @@ -614,6 +624,44 @@ if [ -z "$PLUGIN" -o "$PLUGIN" = "hdp" ]; then unset BASE_IMAGE_FILE DIB_IMAGE_SIZE DIB_CLOUD_IMAGES fi +############################ +# Images for Ambari plugin # +############################ + +if [ -z "$PLUGIN" -o "$PLUGIN" = "ambari" ]; then + export DIB_AMBARI_VERSION="$HADOOP_VERSION" + if [ -z "$BASE_IMAGE_OS" -o "$BASE_IMAGE_OS" = "ubuntu" ]; then + ambari_ubuntu_image_name=${ambari_ubuntu_image_name:-ubuntu_sahara_ambari} + ambari_element_sequence="vm ntp ubuntu ambari $JAVA_ELEMENT" + if [ -n "$USE_MIRRORS" -a "$UBUNTU_MIRROR" ]; then + ambari_element_sequence="$ambari_element_sequence apt-mirror" + fi + export DIB_RELEASE="precise" + disk-image-create $TRACING $ambari_element_sequence -o $ambari_ubuntu_image_name + unset DIB_RELEASE + fi + if [ -z "$BASE_IMAGE_OS" -o "$BASE_IMAGE_OS" = "centos" ]; then + export BASE_IMAGE_FILE="CentOS-6.6-cloud-init-20150821.qcow2" + export DIB_CLOUD_IMAGES="http://sahara-files.mirantis.com" + ambari_centos_image_name=${ambari_centos_image_name:-centos_sahara_ambari} + ambari_element_sequence="vm ntp centos ambari $JAVA_ELEMENT" + if [ -n "$USE_MIRRORS" -a "$CENTOS_MIRROR" ]; then + ambari_element_sequence="$ambari_element_sequence centos-mirror" + fi + if [ "$DEBUG_MODE" = "true" ]; then + ambari_element_sequence="$ambari_element_sequence root-passwd" + fi + disk-image-create $ambari_element_sequence -o $ambari_centos_image_name + unset BASE_IMAGE_FILE DIB_CLOUD_IMAGES + fi + if [ -z "$BASE_IMAGE_OS" -o "$BASE_IMAGE_OS" = "centos7" ]; then + ambari_centos7_image_name=${ambari_centos7_image_name:-"centos7-sahara-ambari"} + ambari_element_sequence="vm ntp centos7 disable-selinux ambari $JAVA_ELEMENT" + disk-image-create $ambari_element_sequence -o $ambari_centos7_image_name + fi + unset DIB_AMBARI_VERSION +fi + ######################### # Images for CDH plugin # ######################### diff --git a/elements/ambari/README.rst b/elements/ambari/README.rst new file mode 100644 index 00000000..9730ac49 --- /dev/null +++ b/elements/ambari/README.rst @@ -0,0 +1,14 @@ +====== +ambari +====== + +Installs Ambari Management Console + +Environment Variables +--------------------- + +AMBARI_VERSION + :Required: No + :Default: 2.0.1 + :Description: Version of Ambari Management Console to install + :Example: ``AMBARI_VERSION="2.0.0"`` installs Ambari 2.0.0 diff --git a/elements/ambari/element-deps b/elements/ambari/element-deps new file mode 100644 index 00000000..e7d2d367 --- /dev/null +++ b/elements/ambari/element-deps @@ -0,0 +1,3 @@ +disable-firewall +java +package-installs diff --git a/elements/ambari/package-installs.yaml b/elements/ambari/package-installs.yaml new file mode 100644 index 00000000..154659e9 --- /dev/null +++ b/elements/ambari/package-installs.yaml @@ -0,0 +1,7 @@ +wget: + phase: pre-install.d +ambari-agent: +ambari-log4j: +ambari-metrics-hadoop-sink: +ambari-metrics-monitor: +ambari-server: diff --git a/elements/ambari/post-install.d/10-disable-ambari b/elements/ambari/post-install.d/10-disable-ambari new file mode 100755 index 00000000..a2662935 --- /dev/null +++ b/elements/ambari/post-install.d/10-disable-ambari @@ -0,0 +1,14 @@ +#!/bin/bash + +if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then + set -x +fi +set -eu +set -o pipefail + +case "${DISTRO_NAME}" in + rhel | centos | centos7 ) + chkconfig ambari-server off + chkconfig ambari-agent off + ;; +esac diff --git a/elements/ambari/pre-install.d/90-ambari-repo-conf b/elements/ambari/pre-install.d/90-ambari-repo-conf new file mode 100755 index 00000000..cb7d14e2 --- /dev/null +++ b/elements/ambari/pre-install.d/90-ambari-repo-conf @@ -0,0 +1,22 @@ +#!/bin/bash + +if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then + set -x +fi +set -eu +set -o pipefail + +DIB_AMBARI_VERSION="${DIB_AMBARI_VERSION:-2.1.0}" + +case "${DISTRO_NAME}" in + rhel | centos ) + wget http://public-repo-1.hortonworks.com/ambari/centos6/2.x/updates/$DIB_AMBARI_VERSION/ambari.repo -O /etc/yum.repos.d/ambari.repo + ;; + centos7 ) + wget http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/$DIB_AMBARI_VERSION/ambari.repo -O /etc/yum.repos.d/ambari.repo + ;; + ubuntu ) + wget http://public-repo-1.hortonworks.com/ambari/ubuntu12/2.x/updates/$DIB_AMBARI_VERSION/ambari.list -O /etc/apt/sources.list.d/ambari.list + apt-key adv --recv-keys --keyserver keyserver.ubuntu.com B9733A7A07513CAD + ;; +esac