Skip to content

Commit

Permalink
Zookeeper setup using offical tarball (also) on debian/ubuntu (#34)
Browse files Browse the repository at this point in the history
* added support to setup zookeeper on debian/ubuntu from the official tarball (same as existing redhat/centos setup)

* undo addition of deb-uninstall

* added debian/ubuntu specific role variable that selects either upstart or systemd for the init script

* update min_ansible_version to 1.6
  • Loading branch information
lhoss authored and ernestas-poskus committed Aug 10, 2016
1 parent 3c48ee7 commit 5106db3
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 3 deletions.
5 changes: 5 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ zookeeper_playbook_version: "0.9.2"
zookeeper_version: 3.4.6
zookeeper_url: http://www.us.apache.org/dist/zookeeper/zookeeper-{{zookeeper_version}}/zookeeper-{{zookeeper_version}}.tar.gz

# Flag that selects if systemd or upstart will be used for the init service:
# Note: by default Ubuntu 15.04 and later use systemd (but support switch to upstart)
zookeeper_debian_systemd_enabled: "{{ ansible_distribution_version|version_compare(15.04, '>=') }}"
zookeeper_debian_apt_install: false
apt_cache_timeout: 3600

client_port: 2181
init_limit: 5
sync_limit: 2
Expand Down
2 changes: 1 addition & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ galaxy_info:
description: Ansible Zookeeper Role
company: http://michaelhamrah.com
license: Apache 2
min_ansible_version: 1.2
min_ansible_version: 1.6
#
# Below are all platforms currently available. Just uncomment
# the ones that apply to your role. If you don't see your
Expand Down
14 changes: 14 additions & 0 deletions tasks/Debian-tarball.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
- include: tarball.yml

- include: upstart.yml
when: not zookeeper_debian_systemd_enabled
tags: deploy

- include: systemd.yml
when: zookeeper_debian_systemd_enabled
tags: deploy

- name: Start zookeeper
service: name=zookeeper state=started enabled=yes
tags: deploy
6 changes: 5 additions & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
---

- include: Debian.yml
when: ansible_os_family == 'Debian'
when: ansible_os_family == 'Debian' and zookeeper_debian_apt_install

- include: Debian-tarball.yml
when: ansible_os_family == 'Debian' and not zookeeper_debian_apt_install

- include: RedHat.yml
when: ansible_os_family == 'RedHat'
2 changes: 1 addition & 1 deletion templates/zookeeper.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ umask 007
kill timeout 300

script
su -c "{{zookeeper_dir}}/bin/zkServer.sh start-foreground > /var/log/zookeeper/init-zookeeper.log" zookeeper
exec sudo -u zookeeper -g zookeeper {{zookeeper_dir}}/bin/zkServer.sh start-foreground > /var/log/zookeeper/init-zookeeper.log 2>&1
end script

0 comments on commit 5106db3

Please sign in to comment.