3f2dd0e681
Zookeeper supports a number of "4 letter" commands [0] which are useful for debugging and general diagnostics. By default only srvr is enabled, but we want to add stat and dump to see details on server and client connection statuses. We do this via the 4lw.commands.whitelist configuration option [1] and not the docker image env vars because we're mounting a zoo.cfg in already. [0] https://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_4lw [1] https://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_clusterOptions Change-Id: I24ea9b37cd5766c9d393106e8eab34623cad1624
64 lines
1.5 KiB
YAML
64 lines
1.5 KiB
YAML
- name: Create Zookeeper group
|
|
group:
|
|
name: "{{ zookeeper_group }}"
|
|
gid: "{{ zookeeper_gid }}"
|
|
system: yes
|
|
- name: Create Zookeeper User
|
|
user:
|
|
name: "{{ zookeeper_user }}"
|
|
group: "{{ zookeeper_group }}"
|
|
uid: "{{ zookeeper_uid }}"
|
|
home: "/home/{{ zookeeper_user }}"
|
|
create_home: yes
|
|
shell: /bin/bash
|
|
system: yes
|
|
- name: Synchronize compose directory
|
|
synchronize:
|
|
src: zookeeper-compose/
|
|
dest: /etc/zookeeper-compose/
|
|
- name: Ensure volume directories exist
|
|
file:
|
|
state: directory
|
|
path: "/var/zookeeper/{{ item }}"
|
|
owner: "{{ zookeeper_user }}"
|
|
group: "{{ zookeeper_group }}"
|
|
loop:
|
|
- conf
|
|
- data
|
|
- datalog
|
|
- logs
|
|
- tls
|
|
- name: Generate ZooKeeper TLS cert
|
|
include_role:
|
|
name: zk-ca
|
|
vars:
|
|
zk_ca_cert_dir: /var/zookeeper/tls
|
|
zk_ca_cert_dir_owner: 10001
|
|
zk_ca_cert_dir_group: 10001
|
|
- name: Write config
|
|
template:
|
|
src: zoo.cfg.j2
|
|
dest: /var/zookeeper/conf/zoo.cfg
|
|
- name: Write ID file
|
|
template:
|
|
src: myid.j2
|
|
dest: /var/zookeeper/data/myid
|
|
- name: Run docker-compose pull
|
|
shell:
|
|
cmd: docker-compose pull
|
|
chdir: /etc/zookeeper-compose/
|
|
- name: Run docker-compose up
|
|
shell:
|
|
cmd: docker-compose up -d
|
|
chdir: /etc/zookeeper-compose/
|
|
- name: Run docker prune to cleanup unneeded images
|
|
shell:
|
|
cmd: docker image prune -f
|
|
|
|
# This is handy to have on the zk cluster for interacting with the 4 letter
|
|
# commands.
|
|
- name: Install netcat
|
|
package:
|
|
name: netcat
|
|
state: present
|