From 2a50167ac1bb05cd3a67ca68e4c7f89c84ee7dcd Mon Sep 17 00:00:00 2001 From: Maarten Bezemer Date: Thu, 20 Oct 2016 14:59:17 +0200 Subject: [PATCH 1/2] Make configuration location customizeable The default for the tarball and RedHat installation is unchanged (zookeeper_dir) The default for the debian package installation is changed to /etc/zookeeper --- README.md | 1 + defaults/main.yml | 1 + tasks/Debian.yml | 4 ++-- tasks/common-config.yml | 4 ++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0e23bee..b893996 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,7 @@ zookeeper_autopurge_snapRetainCount: 10 data_dir: /var/lib/zookeeper log_dir: /var/log/zookeeper zookeeper_dir: /opt/zookeeper-{{zookeeper_version}} +zookeeper_conf_dir: {{zookeeper_dir}} # or /etc/zookeeper when zookeeper_debian_apt_install is true zookeeper_tarball_dir: /opt/src # List of dict (i.e. {zookeeper_hosts:[{host:,id:},{host:,id:},...]}) diff --git a/defaults/main.yml b/defaults/main.yml index 5a18ec1..9a1dd05 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -21,6 +21,7 @@ zookeeper_autopurge_snapRetainCount: 10 data_dir: /var/lib/zookeeper log_dir: /var/log/zookeeper zookeeper_dir: /opt/zookeeper-{{zookeeper_version}} +zookeeper_conf_dir: "{{ zookeeper_debian_apt_install | ternary('/etc/zookeeper', zookeeper_dir) }}" zookeeper_tarball_dir: /opt/src # Rolling file appender setttings diff --git a/tasks/Debian.yml b/tasks/Debian.yml index 1da9302..e33536f 100644 --- a/tasks/Debian.yml +++ b/tasks/Debian.yml @@ -11,13 +11,13 @@ - zookeeperd - name: Overwrite myid file. - template: src=myid.j2 dest=/etc/zookeeper/conf/myid force="{{ zookeeper_force_myid }}" + template: src=myid.j2 dest={{zookeeper_conf_dir}}/conf/myid force="{{ zookeeper_force_myid }}" tags: deploy notify: - Restart zookeeper - name: Overwrite default config file - template: src=zoo.cfg.j2 dest=/etc/zookeeper/conf/zoo.cfg + template: src=zoo.cfg.j2 dest={{zookeeper_conf_dir}}/conf/zoo.cfg tags: deploy notify: - Restart zookeeper diff --git a/tasks/common-config.yml b/tasks/common-config.yml index ca8fdf4..79aca9c 100644 --- a/tasks/common-config.yml +++ b/tasks/common-config.yml @@ -1,13 +1,13 @@ --- - name: Configure zookeeper-env.sh - template: src=zookeeper-env.sh.j2 dest={{ zookeeper_dir }}/conf/zookeeper-env.sh owner=zookeeper group=zookeeper + template: src=zookeeper-env.sh.j2 dest={{ zookeeper_conf_dir }}/conf/zookeeper-env.sh owner=zookeeper group=zookeeper tags: deploy notify: - Restart zookeeper when: zookeeper_env is defined and zookeeper_env|length > 0 - name: Update the log4j config with saner production values - template: src=log4j.properties.j2 dest={{ zookeeper_dir }}/conf/log4j.properties + template: src=log4j.properties.j2 dest={{ zookeeper_conf_dir }}/conf/log4j.properties tags: deploy notify: - Restart zookeeper From 186dd7545a984fc1e63e73575e9c143d2da52633 Mon Sep 17 00:00:00 2001 From: Maarten Bezemer Date: Thu, 20 Oct 2016 15:40:56 +0200 Subject: [PATCH 2/2] Update zookeeper_dir default to support the Debian package default --- README.md | 2 +- defaults/main.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b893996..29a5375 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ zookeeper_autopurge_snapRetainCount: 10 data_dir: /var/lib/zookeeper log_dir: /var/log/zookeeper -zookeeper_dir: /opt/zookeeper-{{zookeeper_version}} +zookeeper_dir: /opt/zookeeper-{{zookeeper_version}} # or /usr/share/zookeeper when zookeeper_debian_apt_install is true zookeeper_conf_dir: {{zookeeper_dir}} # or /etc/zookeeper when zookeeper_debian_apt_install is true zookeeper_tarball_dir: /opt/src diff --git a/defaults/main.yml b/defaults/main.yml index 9a1dd05..7675470 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -20,7 +20,7 @@ zookeeper_autopurge_snapRetainCount: 10 data_dir: /var/lib/zookeeper log_dir: /var/log/zookeeper -zookeeper_dir: /opt/zookeeper-{{zookeeper_version}} +zookeeper_dir: "{{ zookeeper_debian_apt_install | ternary('/usr/share/zookeeper', '/opt/zookeeper-' + zookeeper_version) }}" zookeeper_conf_dir: "{{ zookeeper_debian_apt_install | ternary('/etc/zookeeper', zookeeper_dir) }}" zookeeper_tarball_dir: /opt/src