From 6d24a519cff8dea04e710644dc656a8dbc797cbe Mon Sep 17 00:00:00 2001 From: Paul Belanger Date: Thu, 1 Dec 2016 19:33:41 -0500 Subject: [PATCH] Fix zookeeper_package_name for RedHat Include default zoo.conf file to ensure services start. Change-Id: Ib9aa727c68dc8f0b9a478680254e5737a1d42c58 Signed-off-by: Paul Belanger --- defaults/main.yaml | 9 ++++++++- tasks/config.yaml | 23 +++++++++++++++++++++++ tasks/install/package.yaml | 5 +++++ templates/etc/zookeeper/zoo.cfg | 29 +++++++++++++++++++++++++++++ vars/Debian.yaml | 1 + vars/RedHat.yaml | 1 + 6 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 tasks/config.yaml create mode 100644 templates/etc/zookeeper/zoo.cfg diff --git a/defaults/main.yaml b/defaults/main.yaml index c80d46e..a2a546a 100644 --- a/defaults/main.yaml +++ b/defaults/main.yaml @@ -15,10 +15,17 @@ # tasks/main.yaml zookeeper_task_manager: - install + - config - service +# tasks/config.yaml +zookeeper_file_zoo_conf_dest: /etc/zookeeper/zoo.cfg +zookeeper_file_zoo_conf_group: zookeeper +zookeeper_file_zoo_conf_mode: 0644 +zookeeper_file_zoo_conf_owner: zookeeper +zookeeper_file_zoo_conf_src: etc/zookeeper/zoo.cfg + # tasks/install.yaml -zookeeper_package_name: zookeeperd zookeeper_package_state: installed zookeeper_install_method: package diff --git a/tasks/config.yaml b/tasks/config.yaml new file mode 100644 index 0000000..b8c39c6 --- /dev/null +++ b/tasks/config.yaml @@ -0,0 +1,23 @@ +# Copyright 2015 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: Install zookeeper configuration. + become: yes + template: + dest: "{{ zookeeper_file_zoo_conf_dest }}" + group: "{{ zookeeper_file_zoo_conf_group }}" + mode: "{{ zookeeper_file_zoo_conf_mode }}" + owner: "{{ zookeeper_file_zoo_conf_owner }}" + src: "{{ zookeeper_file_zoo_conf_src }}" + register: zookeeper_file_zoo_conf diff --git a/tasks/install/package.yaml b/tasks/install/package.yaml index 142f223..a3f546d 100644 --- a/tasks/install/package.yaml +++ b/tasks/install/package.yaml @@ -12,6 +12,11 @@ # License for the specific language governing permissions and limitations # under the License. --- +- name: Define zookeeper_package_name + set_fact: + zookeeper_package_name: "{{ __zookeeper_package_name }}" + when: zookeeper_package_name is not defined + - name: Ensure zookeeper is installed. become: yes package: diff --git a/templates/etc/zookeeper/zoo.cfg b/templates/etc/zookeeper/zoo.cfg new file mode 100644 index 0000000..e549a95 --- /dev/null +++ b/templates/etc/zookeeper/zoo.cfg @@ -0,0 +1,29 @@ +# The number of milliseconds of each tick +tickTime=2000 +# The number of ticks that the initial +# synchronization phase can take +initLimit=10 +# The number of ticks that can pass between +# sending a request and getting an acknowledgement +syncLimit=5 +# the directory where the snapshot is stored. +# do not use /tmp for storage, /tmp here is just +# example sakes. +dataDir=/var/lib/zookeeper/data +dataLogDir=/var/lib/zookeeper/log +# the port at which the clients will connect +clientPort=2181 +# the maximum number of client connections. +# increase this if you need to handle more clients +#maxClientCnxns=60 +# +# Be sure to read the maintenance section of the +# administrator guide before turning on autopurge. +# +# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance +# +# The number of snapshots to retain in dataDir +#autopurge.snapRetainCount=3 +# Purge task interval in hours +# Set to "0" to disable auto purge feature +#autopurge.purgeInterval=1 diff --git a/vars/Debian.yaml b/vars/Debian.yaml index 189b8b9..b7e9b26 100644 --- a/vars/Debian.yaml +++ b/vars/Debian.yaml @@ -25,3 +25,4 @@ # License for the specific language governing permissions and limitations # under the License. --- +__zookeeper_package_name: zookeeperd diff --git a/vars/RedHat.yaml b/vars/RedHat.yaml index ca41d99..e2c6ed2 100644 --- a/vars/RedHat.yaml +++ b/vars/RedHat.yaml @@ -12,3 +12,4 @@ # License for the specific language governing permissions and limitations # under the License. --- +__zookeeper_package_name: zookeeper