Add tarball install method
Depends-On: https://review.opendev.org/c/windmill/windmill/+/795909 Depends-On: https://review.opendev.org/c/windmill/windmill/+/795901 Change-Id: I44d663aea48912a8addbd9288687491fa490703e Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
parent
f7660bbaee
commit
473305da06
14
.zuul.yaml
14
.zuul.yaml
@ -1,13 +1,21 @@
|
|||||||
---
|
---
|
||||||
- job:
|
- job:
|
||||||
name: ansible-role-zookeeper
|
name: ansible-role-zookeeper-base
|
||||||
run: tests/playbooks/run.yaml
|
run: tests/playbooks/run.yaml
|
||||||
roles:
|
roles:
|
||||||
- zuul: windmill/ansible-role-zookeeper
|
- zuul: windmill/ansible-role-zookeeper
|
||||||
|
|
||||||
|
- job:
|
||||||
|
name: ansible-role-zookeeper-tarball
|
||||||
|
parent: ansible-role-zookeeper-base
|
||||||
|
nodeset: ubuntu-bionic
|
||||||
|
vars:
|
||||||
|
zookeeper_install_method: tarball
|
||||||
|
zookeeper_tarball_version: 3.5.9
|
||||||
|
|
||||||
- job:
|
- job:
|
||||||
name: ansible-role-zookeeper-ubuntu-bionic
|
name: ansible-role-zookeeper-ubuntu-bionic
|
||||||
parent: ansible-role-zookeeper
|
parent: ansible-role-zookeeper-base
|
||||||
nodeset: ubuntu-bionic
|
nodeset: ubuntu-bionic
|
||||||
|
|
||||||
- project:
|
- project:
|
||||||
@ -15,9 +23,11 @@
|
|||||||
- windmill-jobs-bionic
|
- windmill-jobs-bionic
|
||||||
check:
|
check:
|
||||||
jobs:
|
jobs:
|
||||||
|
- ansible-role-zookeeper-tarball
|
||||||
- ansible-role-zookeeper-ubuntu-bionic
|
- ansible-role-zookeeper-ubuntu-bionic
|
||||||
- tox-linters
|
- tox-linters
|
||||||
gate:
|
gate:
|
||||||
jobs:
|
jobs:
|
||||||
|
- ansible-role-zookeeper-tarball
|
||||||
- ansible-role-zookeeper-ubuntu-bionic
|
- ansible-role-zookeeper-ubuntu-bionic
|
||||||
- tox-linters
|
- tox-linters
|
||||||
|
@ -14,11 +14,18 @@
|
|||||||
---
|
---
|
||||||
# tasks/main.yaml
|
# tasks/main.yaml
|
||||||
zookeeper_task_manager:
|
zookeeper_task_manager:
|
||||||
|
- pre
|
||||||
- install
|
- install
|
||||||
- config
|
- config
|
||||||
- service
|
- service
|
||||||
|
|
||||||
# tasks/config.yaml
|
# tasks/config.yaml
|
||||||
|
zookeeper_user_name: zookeeper
|
||||||
|
zookeeper_user_group: zookeeper
|
||||||
|
zookeeper_user_home: /var/lib/zookeeper
|
||||||
|
zookeeper_user_home_mode: 0750
|
||||||
|
# zookeeper_user_shell:
|
||||||
|
|
||||||
zookeeper_file_myid_group: zookeeper
|
zookeeper_file_myid_group: zookeeper
|
||||||
zookeeper_file_myid_mode: 0644
|
zookeeper_file_myid_mode: 0644
|
||||||
zookeeper_file_myid_owner: zookeeper
|
zookeeper_file_myid_owner: zookeeper
|
||||||
@ -32,7 +39,29 @@ zookeeper_package_state: present
|
|||||||
|
|
||||||
zookeeper_install_method: package
|
zookeeper_install_method: package
|
||||||
|
|
||||||
|
zookeeper_tarball_creates: "{{ zookeeper_tarball_dest }}/apache-zookeeper-{{ zookeeper_tarball_version }}-bin"
|
||||||
|
zookeeper_tarball_dest: "/opt/tarballs"
|
||||||
|
zookeeper_tarball_remote_src: true
|
||||||
|
zookeeper_tarball_src: "https://archive.apache.org/dist/zookeeper/zookeeper-{{ zookeeper_tarball_version }}/apache-zookeeper-{{ zookeeper_tarball_version }}-bin.tar.gz"
|
||||||
|
zookeeper_tarball_symlink: /opt/zookeeper
|
||||||
|
zookeeper_tarball_version:
|
||||||
|
|
||||||
# tasks/service.yaml
|
# tasks/service.yaml
|
||||||
|
zookeeper_file_zookeeper_service_dest: /etc/systemd/system/zookeeper.service
|
||||||
|
zookeeper_file_zookeeper_service_group: root
|
||||||
|
zookeeper_file_zookeeper_service_manage: true
|
||||||
|
zookeeper_file_zookeeper_service_mode: 0644
|
||||||
|
zookeeper_file_zookeeper_service_owner: root
|
||||||
|
zookeeper_file_zookeeper_service_src: etc/systemd/system/zookeeper.service
|
||||||
|
|
||||||
|
zookeeper_file_zookeeper_service_config_dest: /etc/systemd/system/zookeeper.service.d/override.conf
|
||||||
|
zookeeper_file_zookeeper_service_config_group: root
|
||||||
|
zookeeper_file_zookeeper_service_config_manage: true
|
||||||
|
zookeeper_file_zookeeper_service_config_mode: 0644
|
||||||
|
zookeeper_file_zookeeper_service_config_owner: root
|
||||||
|
zookeeper_file_zookeeper_service_config_src: etc/systemd/system/zookeeper.service.d/override.conf
|
||||||
|
|
||||||
|
zookeeper_service_zookeeper_daemon_reload: true
|
||||||
zookeeper_service_zookeeper_enabled: yes
|
zookeeper_service_zookeeper_enabled: yes
|
||||||
zookeeper_service_zookeeper_manage: true
|
zookeeper_service_zookeeper_manage: true
|
||||||
zookeeper_service_zookeeper_name: zookeeper
|
zookeeper_service_zookeeper_name: zookeeper
|
||||||
|
@ -32,6 +32,18 @@
|
|||||||
zookeeper_file_zoo_conf_src: "{{ __zookeeper_file_zoo_conf_src }}"
|
zookeeper_file_zoo_conf_src: "{{ __zookeeper_file_zoo_conf_src }}"
|
||||||
when: zookeeper_file_zoo_conf_src is not defined
|
when: zookeeper_file_zoo_conf_src is not defined
|
||||||
|
|
||||||
|
- name: Create required directories
|
||||||
|
become: true
|
||||||
|
file:
|
||||||
|
group: "{{ zookeeper_user_group }}"
|
||||||
|
owner: "{{ zookeeper_user_name }}"
|
||||||
|
path: "{{ item }}"
|
||||||
|
state: directory
|
||||||
|
with_items:
|
||||||
|
- /etc/zookeeper
|
||||||
|
- /etc/zookeeper/conf
|
||||||
|
- /var/log/zookeeper
|
||||||
|
|
||||||
- name: Install zookeeper myid
|
- name: Install zookeeper myid
|
||||||
become: yes
|
become: yes
|
||||||
template:
|
template:
|
||||||
|
60
tasks/install/tarball.yaml
Normal file
60
tasks/install/tarball.yaml
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
# Copyright 2021 Red Hat, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
---
|
||||||
|
- name: Ensure java is present
|
||||||
|
become: true
|
||||||
|
package:
|
||||||
|
name: default-jre-headless
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Create required directory
|
||||||
|
become: true
|
||||||
|
file:
|
||||||
|
path: "{{ zookeeper_tarball_dest }}"
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: Ensure zookeeper is present
|
||||||
|
become: true
|
||||||
|
unarchive:
|
||||||
|
creates: "{{ zookeeper_tarball_creates }}"
|
||||||
|
dest: "{{ zookeeper_tarball_dest }}"
|
||||||
|
remote_src: "{{ zookeeper_tarball_remote_src }}"
|
||||||
|
src: "{{ zookeeper_tarball_src }}"
|
||||||
|
|
||||||
|
- name: Stat zookeeper_tarball_symlink
|
||||||
|
stat:
|
||||||
|
path: "{{ zookeeper_tarball_symlink | dirname }}"
|
||||||
|
register: r
|
||||||
|
no_log: true
|
||||||
|
when: zookeeper_tarball_symlink is defined
|
||||||
|
|
||||||
|
- name: Create zookeeper_tarball_symlink directory
|
||||||
|
become: true
|
||||||
|
file:
|
||||||
|
state: directory
|
||||||
|
path: "{{ zookeeper_tarball_symlink | dirname }}"
|
||||||
|
when:
|
||||||
|
- zookeeper_tarball_symlink is defined
|
||||||
|
- not r.stat.exists
|
||||||
|
|
||||||
|
- name: Symlink zookeeper tarball
|
||||||
|
become: true
|
||||||
|
file:
|
||||||
|
dest: "{{ zookeeper_tarball_symlink }}"
|
||||||
|
src: "{{ zookeeper_tarball_creates }}"
|
||||||
|
state: link
|
||||||
|
when:
|
||||||
|
- zookeeper_tarball_creates is defined
|
||||||
|
- zookeeper_tarball_symlink is defined
|
||||||
|
- zookeeper_tarball_creates != zookeeper_tarball_symlink
|
36
tasks/pre.yaml
Normal file
36
tasks/pre.yaml
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# Copyright 2021 Red Hat, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
---
|
||||||
|
- name: Create zookeeper user / group
|
||||||
|
block:
|
||||||
|
- name: Create group account
|
||||||
|
become: true
|
||||||
|
group:
|
||||||
|
name: "{{ zookeeper_user_group }}"
|
||||||
|
|
||||||
|
- name: Create user account
|
||||||
|
become: true
|
||||||
|
user:
|
||||||
|
createhome: true
|
||||||
|
group: "{{ zookeeper_user_group }}"
|
||||||
|
home: "{{ zookeeper_user_home }}"
|
||||||
|
name: "{{ zookeeper_user_name }}"
|
||||||
|
shell: "{{ zookeeper_user_shell|default(omit) }}"
|
||||||
|
|
||||||
|
- name: Set permissions on home directory
|
||||||
|
become: true
|
||||||
|
file:
|
||||||
|
path: "{{ zookeeper_user_home }}"
|
||||||
|
mode: "{{ zookeeper_user_home_mode }}"
|
||||||
|
when: zookeeper_install_method != 'package'
|
@ -12,6 +12,40 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
---
|
---
|
||||||
|
- name: Install systemd files
|
||||||
|
block:
|
||||||
|
- name: Install zookeeper service script into place
|
||||||
|
become: true
|
||||||
|
template:
|
||||||
|
dest: "{{ zookeeper_file_zookeeper_service_dest }}"
|
||||||
|
group: "{{ zookeeper_file_zookeeper_service_group }}"
|
||||||
|
mode: "{{ zookeeper_file_zookeeper_service_mode }}"
|
||||||
|
owner: "{{ zookeeper_file_zookeeper_service_owner }}"
|
||||||
|
src: "{{ zookeeper_file_zookeeper_service_src }}"
|
||||||
|
register: zookeeper_file_zookeeper_service
|
||||||
|
when: zookeeper_file_zookeeper_service_manage
|
||||||
|
|
||||||
|
- name: Create zookeeper service config directory
|
||||||
|
become: true
|
||||||
|
file:
|
||||||
|
group: "{{ zookeeper_file_zookeeper_service_config_group }}"
|
||||||
|
owner: "{{ zookeeper_file_zookeeper_service_config_owner }}"
|
||||||
|
path: "{{ zookeeper_file_zookeeper_service_dest }}.d"
|
||||||
|
state: directory
|
||||||
|
when: zookeeper_file_zookeeper_service_config_manage
|
||||||
|
|
||||||
|
- name: Install zookeeper service config into place
|
||||||
|
become: true
|
||||||
|
template:
|
||||||
|
dest: "{{ zookeeper_file_zookeeper_service_config_dest }}"
|
||||||
|
group: "{{ zookeeper_file_zookeeper_service_config_group }}"
|
||||||
|
mode: "{{ zookeeper_file_zookeeper_service_config_mode }}"
|
||||||
|
owner: "{{ zookeeper_file_zookeeper_service_config_owner }}"
|
||||||
|
src: "{{ zookeeper_file_zookeeper_service_config_src }}"
|
||||||
|
register: zookeeper_file_zookeeper_service_config
|
||||||
|
when: zookeeper_file_zookeeper_service_config_manage
|
||||||
|
when: zookeeper_install_method != 'package'
|
||||||
|
|
||||||
- name: Enable zookeeper service
|
- name: Enable zookeeper service
|
||||||
become: yes
|
become: yes
|
||||||
service:
|
service:
|
||||||
@ -20,3 +54,14 @@
|
|||||||
state: "{{ zookeeper_service_zookeeper_state }}"
|
state: "{{ zookeeper_service_zookeeper_state }}"
|
||||||
register: zookeeper_service_zookeeper
|
register: zookeeper_service_zookeeper
|
||||||
when: zookeeper_service_zookeeper_manage
|
when: zookeeper_service_zookeeper_manage
|
||||||
|
|
||||||
|
- name: Set zookeeper service state
|
||||||
|
become: true
|
||||||
|
systemd:
|
||||||
|
daemon_reload: "{{ zookeeper_service_zookeeper_daemon_reload }}"
|
||||||
|
name: "{{ zookeeper_service_zookeeper_name }}"
|
||||||
|
state: "{{ zookeeper_service_zookeeper_state }}"
|
||||||
|
register: zookeeper_service_zookeeper_state_info
|
||||||
|
when:
|
||||||
|
- zookeeper_service_zookeeper_manage
|
||||||
|
- zookeeper_service_zookeeper_state in ['reloaded', 'restarted', 'started', 'stopped']
|
||||||
|
18
templates/etc/systemd/system/zookeeper.service
Normal file
18
templates/etc/systemd/system/zookeeper.service
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=ZooKeeper Service
|
||||||
|
Documentation=http://zookeeper.apache.org
|
||||||
|
Requires=network.target
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=forking
|
||||||
|
User=zookeeper
|
||||||
|
Group=zookeeper
|
||||||
|
Environment=ZOO_LOG_DIR=/var/log/zookeeper
|
||||||
|
ExecStart=/opt/zookeeper/bin/zkServer.sh --config /etc/zookeeper/conf start
|
||||||
|
ExecStop=/opt/zookeeper/bin/zkServer.sh --config /etc/zookeeper/conf stop
|
||||||
|
ExecReload=/opt/zookeeper/bin/zkServer.sh --config /etc/zookeeper/conf restart
|
||||||
|
WorkingDirectory=/opt/zookeeper
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=default.target
|
@ -0,0 +1,3 @@
|
|||||||
|
# This file is generated by Ansible
|
||||||
|
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
|
||||||
|
#
|
Loading…
Reference in New Issue
Block a user