testsuite: Use more ansible for setup
This commit is contained in:
parent
9a3a0f4de2
commit
b1e7dac0f9
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,7 +5,6 @@ hbase-protobuf-python/__pycache__/
|
|||||||
hbase-protobuf-python/client/
|
hbase-protobuf-python/client/
|
||||||
hbase-protobuf-python/server/
|
hbase-protobuf-python/server/
|
||||||
bash_unit
|
bash_unit
|
||||||
tests/hbase
|
|
||||||
tests/hbase-?.?.?/
|
tests/hbase-?.?.?/
|
||||||
tests/hbase-?.?.?-bin.tar.gz
|
tests/hbase-?.?.?-bin.tar.gz
|
||||||
tests/hbase-?.??.?.?-hadoop2-bin.tar.gz
|
tests/hbase-?.??.?.?-hadoop2-bin.tar.gz
|
||||||
|
6
tests/hbase-create.yml
Normal file
6
tests/hbase-create.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- hosts: namenodes
|
||||||
|
roles:
|
||||||
|
- hbase
|
||||||
|
|
3
tests/hbase/defaults/main.yml
Normal file
3
tests/hbase/defaults/main.yml
Normal 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 }}"
|
@ -38,32 +38,6 @@ EOF
|
|||||||
echo "$CONFIG"
|
echo "$CONFIG"
|
||||||
}
|
}
|
||||||
|
|
||||||
prepare_hbase() {
|
|
||||||
if ! [ -f "$HBASE_TEST_SUITE_EXECUTABLE" ]; then
|
|
||||||
if [ -f "$HBASE_FILE" ]; then
|
|
||||||
printf "HBase archive exists\n"
|
|
||||||
if compare_checksum $HBASE_FILE $HBASE_FILE_CKSUM; then
|
|
||||||
extract_archive $HBASE_FILE $HBASE_VERSION
|
|
||||||
mv -f "${HBASE_DIR}" hbase
|
|
||||||
return
|
|
||||||
else
|
|
||||||
printf "HBase archive has wrong checksum (%s)\n" "$1"
|
|
||||||
printf "Execute script again to redownload file\n"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
printf "Downloading %s\n" "$1"
|
|
||||||
curl -LO "${1}"
|
|
||||||
|
|
||||||
if compare_checksum $HBASE_FILE $HBASE_FILE_CKSUM; then
|
|
||||||
extract_archive $HBASE_FILE $HBASE_VERSION
|
|
||||||
mv -f ${HBASE_DIR} hbase
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
check_dependencies
|
check_dependencies
|
||||||
#prepare_hbase ${HBASE_URL}
|
|
||||||
HBASE_CONFIG=$(create_hbase_config_template)
|
HBASE_CONFIG=$(create_hbase_config_template)
|
||||||
write_file ${HBASE_CONFIG_TEMPLATE} "${HBASE_CONFIG}"
|
write_file ${HBASE_CONFIG_TEMPLATE} "${HBASE_CONFIG}"
|
29
tests/hbase/tasks/main.yml
Normal file
29
tests/hbase/tasks/main.yml
Normal 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
|
@ -3,4 +3,3 @@
|
|||||||
- hosts: namenodes
|
- hosts: namenodes
|
||||||
roles:
|
roles:
|
||||||
- hdfs
|
- hdfs
|
||||||
|
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
hadoop_version: "2.10.0"
|
||||||
|
hadoop_archive_file: "hadoop-{{ hadoop_version }}.tar.gz"
|
||||||
|
hadoop_archive_url: "https://artfiles.org/apache.org/hadoop/common/hadoop-{{ hadoop_version }}}/{{ hadoop_archive_file }}"
|
@ -114,33 +114,7 @@ EOF
|
|||||||
echo "$CONFIG"
|
echo "$CONFIG"
|
||||||
}
|
}
|
||||||
|
|
||||||
prepare_hadoop() {
|
|
||||||
if ! [ -f "$HDFS_TEST_SUITE_EXECUTABLE" ]; then
|
|
||||||
printf "Setting up Hadoop\n"
|
|
||||||
if [ -f "$HADOOP_FILE" ]; then
|
|
||||||
printf "Hadoop archive exists\n"
|
|
||||||
if compare_checksum $HADOOP_FILE $HADOOP_FILE_CKSUM; then
|
|
||||||
extract_archive "$HADOOP_FILE" "$HADOOP_VERSION"
|
|
||||||
mv -f hadoop-$HADOOP_VERSION hadoop/
|
|
||||||
return
|
|
||||||
else
|
|
||||||
printf "Hadoop archive has wrong checksum (%s)\n" "$1"
|
|
||||||
printf "Execute script again to redownload file\n"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
printf "Downloading %s\n" "$1"
|
|
||||||
curl -LO "${1}"
|
|
||||||
if compare_checksum $HADOOP_FILE $HADOOP_FILE_CKSUM; then
|
|
||||||
extract_archive "$HADOOP_FILE" "$HADOOP_VERSION"
|
|
||||||
mv -f hadoop-$HADOOP_VERSION hadoop/
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
check_dependencies
|
check_dependencies
|
||||||
prepare_hadoop ${HADOOP_URL}
|
|
||||||
HDFS_CONFIG=$(create_hdfs_config_template)
|
HDFS_CONFIG=$(create_hdfs_config_template)
|
||||||
HDFS_CONFIG_CORE=$(create_hdfs_core_config_template)
|
HDFS_CONFIG_CORE=$(create_hdfs_core_config_template)
|
||||||
HDFS_CONFIG_MAPRED=$(create_hdfs_mapred_config_template)
|
HDFS_CONFIG_MAPRED=$(create_hdfs_mapred_config_template)
|
@ -1,9 +1,29 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: Download and extract HDFS archive
|
- name: Download Hadoop archive
|
||||||
ansible.builtin.shell:
|
get_url:
|
||||||
cmd: hdfs-setup.sh
|
url: "{{ hadoop_archive_url }}"
|
||||||
chdir: "{{ hadoop_prefix }}"
|
dest: "{{ script_path }}"
|
||||||
|
mode: 0600
|
||||||
|
checksum: sha256:273d5fa1d479d0bb96759b16cf4cbd6ba3e7f863a0778cbae55ab83417e961f0
|
||||||
|
delegate_to: localhost
|
||||||
|
|
||||||
|
- name: Copy archive
|
||||||
|
copy:
|
||||||
|
src: "{{ script_path }}/{{ hadoop_archive }}"
|
||||||
|
dest: "/tmp"
|
||||||
|
remote_src: yes
|
||||||
|
|
||||||
|
- name: Extract archive
|
||||||
|
ansible.builtin.unarchive:
|
||||||
|
src: "/tmp/{{ hadoop_archive }}"
|
||||||
|
dest: "{{ script_path }}"
|
||||||
|
remote_src: yes
|
||||||
|
|
||||||
|
- name: Write config template
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: "{{ script_path }}/hdfs/files/hadoop-config.sh"
|
||||||
|
delegate_to: localhost
|
||||||
|
|
||||||
- name: Create core-site.xml
|
- name: Create core-site.xml
|
||||||
template: src={{ hdfs_config_path}}/core-site.xml.j2 dest={{ hdfs_config_path}}/core-site.xml mode=0700
|
template: src={{ hdfs_config_path}}/core-site.xml.j2 dest={{ hdfs_config_path}}/core-site.xml mode=0700
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
all:
|
all:
|
||||||
|
vars:
|
||||||
|
|
||||||
children:
|
children:
|
||||||
namenodes:
|
namenodes:
|
||||||
vars:
|
vars:
|
||||||
|
Loading…
Reference in New Issue
Block a user