testsuite: Use more ansible for setup

This commit is contained in:
Björn Busse 2021-03-08 23:45:28 +01:00
parent 9a3a0f4de2
commit b1e7dac0f9
10 changed files with 67 additions and 58 deletions

View file

@ -0,0 +1,3 @@
hbase_version: "0.96.1.1"
hbase_archive: "hbase-{{ hbase_version }}-hadoop2-bin.tar.gz"
hbase_archive_url: "https://archive.apache.org/dist/hbase/hbase-{{ hbase_version }}/{{ hbase_archive }}"

View file

@ -0,0 +1,43 @@
#!/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_CONFIG_TEMPLATE="hbase/conf/hbase-site.xml.j2"
HBASE_TEST_SUITE_EXECUTABLE="hbase/bin/hbase"
declare -a DEPS=("java")
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"
}
check_dependencies
HBASE_CONFIG=$(create_hbase_config_template)
write_file ${HBASE_CONFIG_TEMPLATE} "${HBASE_CONFIG}"

View file

@ -0,0 +1,29 @@
---
- name: Download HBase archive
get_url:
url: "{{ hbase_archive_url }}"
dest: "{{ script_path }}"
mode: 0600
checksum: sha256:7334e7da0b655ab02cfc64454c3d2e93a4c584efbde2dfd37915b9530d1643f8
delegate_to: localhost
- name: Copy archive
copy:
src: "{{ script_path }}/{{ hbase_file }}"
dest: "/tmp"
remote_src: yes
- name: Extract archive
ansible.builtin.unarchive:
src: "/tmp/{{ hbase_file }}"
dest: "{{ script_path }}"
remote_src: yes
- name: Write config template
ansible.builtin.command:
cmd: "{{ script_path }}/hbase/files/hbase-config.sh"
delegate_to: localhost
- name: Create hbase-site.xml
template: src={{ script_path }}/{{ hbase_config_path }}/hbase-site.xml.j2 dest={{ script_path }}/{{ hbase_config_path }}/hbase-site.xml mode=0700