- 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: opendev-ca vars: opendev_ca_name: zk opendev_ca_cert_dir: /var/zookeeper/tls opendev_ca_cert_dir_owner: 10001 opendev_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