ensure-zookeeper: add role to setup zookeeper
This role is lifted from https://src.fedoraproject.org/rpms/zuul/blob/master/f/tests/setup_zookeeper.yml Co-Authored-By: Fabien Boucher <fboucher@redhat.com> Change-Id: Iec21d12baddf3de580d1941adade107c7e24fdd9
This commit is contained in:
parent
b7d151c911
commit
a086fb4333
@ -3,6 +3,7 @@ System Roles
|
||||
|
||||
.. zuul:autorole:: ensure-package-repositories
|
||||
.. zuul:autorole:: ensure-phoronix-test-suite
|
||||
.. zuul:autorole:: ensure-zookeeper
|
||||
.. zuul:autorole:: phoronix-test-suite
|
||||
.. zuul:autorole:: phoronix-combine-results
|
||||
.. zuul:autorole:: fetch-phoronix-results
|
||||
|
10
roles/ensure-zookeeper/README.rst
Normal file
10
roles/ensure-zookeeper/README.rst
Normal file
@ -0,0 +1,10 @@
|
||||
Ensure zookeeper is running
|
||||
|
||||
Install and start zookeeper using the upsteam release.
|
||||
|
||||
**Role Variables**
|
||||
|
||||
.. zuul:rolevar:: zookeeper_version
|
||||
:default: latest
|
||||
|
||||
The zookeeper version.
|
3
roles/ensure-zookeeper/defaults/main.yaml
Normal file
3
roles/ensure-zookeeper/defaults/main.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
zookeeper_version: "latest"
|
||||
_zookeeper_latest_version: "3.6.1"
|
||||
_zookeeper_install_version: "{% if zookeeper_version == 'latest' %}{{ _zookeeper_latest_version }}{% else %}{{ zookeeper_version }}{% endif %}"
|
41
roles/ensure-zookeeper/tasks/main.yaml
Normal file
41
roles/ensure-zookeeper/tasks/main.yaml
Normal file
@ -0,0 +1,41 @@
|
||||
- name: Install JDK
|
||||
package:
|
||||
name: java-latest-openjdk
|
||||
state: present
|
||||
become: true
|
||||
|
||||
- name: Create /tmp/zookeeper
|
||||
file:
|
||||
path: /tmp/zookeeper
|
||||
state: directory
|
||||
become: true
|
||||
|
||||
- name: Get and extract Zookeeper
|
||||
unarchive:
|
||||
src: https://archive.apache.org/dist/zookeeper/zookeeper-{{ _zookeeper_install_version }}/apache-zookeeper-{{ _zookeeper_install_version }}-bin.tar.gz
|
||||
dest: /tmp/zookeeper
|
||||
remote_src: yes
|
||||
become: true
|
||||
|
||||
- name: Link install to a known location
|
||||
file:
|
||||
src: /tmp/zookeeper/apache-zookeeper-{{ _zookeeper_install_version }}-bin
|
||||
dest: /opt/zookeeper
|
||||
state: link
|
||||
become: true
|
||||
|
||||
- name: Setup Zookeeper config file
|
||||
copy:
|
||||
src: /opt/zookeeper/conf/zoo_sample.cfg
|
||||
dest: /opt/zookeeper/conf/zoo.cfg
|
||||
remote_src: true
|
||||
become: true
|
||||
|
||||
- name: Ensure Zookeeper not running
|
||||
command: pkill -f zookeeper
|
||||
ignore_errors: true
|
||||
become: true
|
||||
|
||||
- name: Start Zookeeper
|
||||
command: /opt/zookeeper/bin/zkServer.sh start
|
||||
become: true
|
8
test-playbooks/ensure-zookeeper.yaml
Normal file
8
test-playbooks/ensure-zookeeper.yaml
Normal file
@ -0,0 +1,8 @@
|
||||
- hosts: all
|
||||
tasks:
|
||||
- name: Include ensure-zookeeper
|
||||
include_role:
|
||||
name: ensure-zookeeper
|
||||
|
||||
- name: Test zookeeper is running
|
||||
command: /opt/zookeeper/bin/zkCli.sh ls /
|
@ -630,6 +630,18 @@
|
||||
- name: fedora-32
|
||||
label: fedora-32
|
||||
|
||||
- job:
|
||||
name: zuul-jobs-test-ensure-zookeeper
|
||||
description: Test the ensure-zookeeper roles
|
||||
files:
|
||||
- roles/ensure-zookeeper/.*
|
||||
- test-playbooks/ensure-zookeeper.yaml
|
||||
run: test-playbooks/ensure-zookeeper.yaml
|
||||
nodeset:
|
||||
nodes:
|
||||
- name: fedora-32
|
||||
label: fedora-32
|
||||
|
||||
# -* AUTOGENERATED *-
|
||||
# The following project section is autogenerated by
|
||||
# tox -e update-test-platforms
|
||||
@ -679,6 +691,7 @@
|
||||
- zuul-jobs-test-upload-artifactory
|
||||
- zuul-jobs-test-upload-git-mirror
|
||||
- zuul-jobs-test-shake-build
|
||||
- zuul-jobs-test-ensure-zookeeper
|
||||
gate:
|
||||
jobs: &id001
|
||||
- zuul-jobs-test-add-authorized-keys
|
||||
@ -718,5 +731,6 @@
|
||||
- zuul-jobs-test-upload-artifactory
|
||||
- zuul-jobs-test-upload-git-mirror
|
||||
- zuul-jobs-test-shake-build
|
||||
- zuul-jobs-test-ensure-zookeeper
|
||||
periodic-weekly:
|
||||
jobs: *id001
|
||||
|
Loading…
Reference in New Issue
Block a user