Add files
This commit is contained in:
parent
2900359e53
commit
d20e855344
11 changed files with 322 additions and 0 deletions
7
roles/hbase/defaults/main.yml
Normal file
7
roles/hbase/defaults/main.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
hbase_version: "0.96.1.1"
|
||||
hbase_archive_file: "hbase-{{ hbase_version }}-hadoop2-bin.tar.gz"
|
||||
hbase_archive_file_checksum256: "7334e7da0b655ab02cfc64454c3d2e93a4c584efbde2dfd37915b9530d1643f8"
|
||||
hbase_archive_url: "https://archive.apache.org/dist/hbase/hbase-{{ hbase_version }}/{{ hbase_archive_file }}"
|
||||
hbase_config_path: "/tmp/hbase/conf"
|
||||
hbase_rootdir: "/tmp/hbase-root"
|
||||
hbase_datadir: "/tmp/hbase-data"
|
40
roles/hbase/files/hbase-config.sh
Executable file
40
roles/hbase/files/hbase-config.sh
Executable file
|
@ -0,0 +1,40 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -ueo pipefail
|
||||
|
||||
HBASE_VERSION="0.96.1.1"
|
||||
HBASE_FILE="hbase-${HBASE_VERSION}-hadoop2-bin.tar.gz"
|
||||
HBASE_DIR="hbase-${HBASE_VERSION}-hadoop2"
|
||||
#HBASE_URL="https://downloads.apache.org/hbase/${HBASE_VERSION}/${HBASE_FILE}"
|
||||
HBASE_URL="https://archive.apache.org/dist/hbase/hbase-${HBASE_VERSION}/${HBASE_FILE}"
|
||||
HBASE_FILE_CKSUM="1625453f839f7d8c86078a131af9731f6df28c59e58870db84913dcbc640d430253134a825de7cec247ea1f0cf232435765e00844ee2e4faf31aeb356955c478"
|
||||
HBASE_PATH="/tmp"
|
||||
HBASE_CONFIG_TEMPLATE="${HBASE_PATH}/hbase/conf/hbase-site.xml.j2"
|
||||
|
||||
SCRIPT_PATH=$(dirname "$0")
|
||||
source $SCRIPT_PATH/../../../setup.sh
|
||||
|
||||
create_hbase_config_template() {
|
||||
read -r -d '' CONFIG <<EOF
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
|
||||
<configuration>
|
||||
<property>
|
||||
<name>hbase.rootdir</name>
|
||||
<value>file:///{{ hbase_rootdir }}/hbase</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>hbase.zookeeper.property.dataDir</name>
|
||||
<value>{{ hbase_datadir }}/zookeeper</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>hbase.unsafe.stream.capability.enforce</name>
|
||||
<value>false</value>
|
||||
</property>
|
||||
</configuration>
|
||||
EOF
|
||||
echo "$CONFIG"
|
||||
}
|
||||
|
||||
HBASE_CONFIG=$(create_hbase_config_template)
|
||||
write_file ${HBASE_CONFIG_TEMPLATE} "${HBASE_CONFIG}"
|
31
roles/hbase/tasks/main.yml
Normal file
31
roles/hbase/tasks/main.yml
Normal file
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
|
||||
- name: Download HBase archive locally
|
||||
get_url:
|
||||
url: "{{ hbase_archive_url }}"
|
||||
dest: "/tmp/hbase.tar.gz"
|
||||
mode: 0600
|
||||
checksum: sha256:{{ hbase_archive_file_checksum256 }}
|
||||
run_once: true
|
||||
delegate_to: localhost
|
||||
|
||||
- name: Copy and extract archive
|
||||
ansible.builtin.unarchive:
|
||||
src: "/tmp/hbase.tar.gz"
|
||||
dest: "/tmp"
|
||||
|
||||
- name: Recursively remove directory
|
||||
ansible.builtin.file:
|
||||
path: /tmp/hbase
|
||||
state: absent
|
||||
|
||||
- name: Rename dir
|
||||
command: mv -f /tmp/hbase-0.96.1.1-hadoop2 /tmp/hbase
|
||||
|
||||
- name: Write config template
|
||||
ansible.builtin.command:
|
||||
cmd: "hbase/files/hbase-config.sh"
|
||||
delegate_to: localhost
|
||||
|
||||
- name: Create hbase-site.xml
|
||||
template: src={{ hbase_config_path }}/hbase-site.xml.j2 dest={{ hbase_config_path }}/hbase-site.xml mode=0700
|
Loading…
Add table
Add a link
Reference in a new issue