{"id":13434769,"url":"https://github.com/sleighzy/ansible-zookeeper","last_synced_at":"2026-03-06T08:03:05.484Z","repository":{"id":41493430,"uuid":"82155688","full_name":"sleighzy/ansible-zookeeper","owner":"sleighzy","description":"Ansible role for installing and configuring Apache ZooKeeper","archived":false,"fork":false,"pushed_at":"2024-10-29T07:03:59.000Z","size":97,"stargazers_count":81,"open_issues_count":5,"forks_count":69,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-29T07:30:51.419Z","etag":null,"topics":["ansible","ansible-galaxy","ansible-role","debian","molecule","redhat","rhel","zookeeper"],"latest_commit_sha":null,"homepage":"","language":"YAML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sleighzy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-16T08:07:40.000Z","updated_at":"2024-10-29T06:57:47.000Z","dependencies_parsed_at":"2022-08-28T18:20:45.425Z","dependency_job_id":"9cbf8d33-1af2-4980-b69b-4ff825cfe268","html_url":"https://github.com/sleighzy/ansible-zookeeper","commit_stats":{"total_commits":86,"total_committers":12,"mean_commits":7.166666666666667,"dds":0.7093023255813953,"last_synced_commit":"92420cbbf594658b16695f5b97f8b3940107107f"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sleighzy%2Fansible-zookeeper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sleighzy%2Fansible-zookeeper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sleighzy%2Fansible-zookeeper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sleighzy%2Fansible-zookeeper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sleighzy","download_url":"https://codeload.github.com/sleighzy/ansible-zookeeper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247266565,"owners_count":20910836,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","ansible-galaxy","ansible-role","debian","molecule","redhat","rhel","zookeeper"],"created_at":"2024-07-31T03:00:22.506Z","updated_at":"2026-03-06T08:03:05.471Z","avatar_url":"https://github.com/sleighzy.png","language":"YAML","funding_links":[],"categories":["HarmonyOS","YAML"],"sub_categories":["Windows Manager"],"readme":"# Apache ZooKeeper\n\n![Lint Code Base] ![Molecule]\n\nAnsible role for installing and configuring Apache ZooKeeper\n\nThis role can be used to install and cluster multiple ZooKeeper nodes, this uses\nall hosts defined for the \"zookeeper-nodes\" group in the inventory file by\ndefault. All servers are added to the zoo.cfg file along with the leader and\nelection ports. Firewall ports could be opened after setting `true` to\n`zookeeper_firewalld` variable\n\n## Supported Platforms\n\n- Debian 10.x\n- RedHat 7\n- RedHat 8\n- Ubuntu 18.04.x\n- Ubuntu 20.04.x\n\n## Requirements\n\nJava: Java 8 / 11\n\nAnsible 2.9.16 or 2.10.4 are the minimum required versions to workaround an\nissue with certain kernels that have broken the `systemd` status check. The\nerror message \"`Service is in unknown state`\" will be output when attempting to\nstart the service via the Ansible role and the task will fail. The service will\nstart as expected if the `systemctl start` command is run on the physical host.\nSee \u003chttps://github.com/ansible/ansible/issues/71528\u003e for more information.\n\n## Role Variables\n\n| Variable                                 | Default                                                           | Comment                                                        |\n| ---------------------------------------- | ----------------------------------------------------------------- | -------------------------------------------------------------- |\n| zookeeper_mirror                         | \u003chttps://dlcdn.apache.org/zookeeper\u003e                              |                                                                |\n| zookeeper_version                        | 3.9.4                                                             |                                                                |\n| zookeeper_package                        | apache-zookeeper-{{ zookeeper_version }}-bin.tar.gz               |                                                                |\n| zookeeper_group                          | zookeeper                                                         |                                                                |\n| zookeeper_user                           | zookeeper                                                         |                                                                |\n| zookeeper_root_dir                       | /usr/share                                                        |                                                                |\n| zookeeper_install_dir                    | '{{ zookeeper_root_dir}}/apache-zookeeper-{{zookeeper_version}}'  |                                                                |\n| zookeeper_dir                            | '{{ zookeeper_root_dir }}/zookeeper'                              |                                                                |\n| zookeeper_log_dir                        | /var/log/zookeeper                                                |                                                                |\n| zookeeper_data_dir                       | /var/lib/zookeeper                                                |                                                                |\n| zookeeper_data_log_dir                   | /var/lib/zookeeper                                                |                                                                |\n| zookeeper_client_port                    | 2181                                                              |                                                                |\n| zookeeper_id                             | 1                                                                 | Unique per server and should be declared in the inventory file |\n| zookeeper_leader_port                    | 2888                                                              |                                                                |\n| zookeeper_election_port                  | 3888                                                              |                                                                |\n| zookeeper_servers                        | zookeeper-nodes                                                   | See below                                                      |\n| zookeeper_servers_use_inventory_hostname | false                                                             | See below                                                      |\n| zookeeper_environment                    | \"JVMFLAGS\": \"-javaagent:/opt/jolokia/jolokia-jvm-1.6.0-agent.jar\" |                                                                |\n| zookeeper_config_params                  |                                                                   | A key-value dictionary that will be templated into zoo.cfg     |\n| zookeeper_firewalld                      | false                                                             |                                                                |\n\n## Inventory and zookeeper_servers variable\n\nzookeeper_servers variable above accepts a list of inventory hostnames. These\nwill be used in the `zoo.cfg` to configure a multi-server cluster so the hosts\ncan find each other. By default, the hostname used in the `zoo.cfg` will be the\nhostname reported by the `hostname` command on the server(provided by the\n`ansible_nodename` variable). See the example below.\n\nAssuming the below inventory file, and that the `hostname` command returns only\nthe hostname and does not include the domain name.\n\n```ini\n[zookeeper-nodes]\nzoo1.foo.com zookeeper_id=1       #hostname command returns \"zoo1\"\nzoo2.foo.com zookeeper_id=2       #hostname command returns \"zoo2\"\nzoo3.foo.com zookeeper_id=3       #hostname command returns \"zoo3\"\n```\n\nAnd assuming the following role variables:\n\n```yaml\n---\n- role: sleighzy.zookeeper\n  zookeeper_servers:\n    - zoo1.foo.com\n    - zoo2.foo.com\n    - zoo3.foo.com\n```\n\nThe templated `zoo.cfg` file will contain the below entries:\n\n```ini\nserver.1=zoo1:2888:3888\nserver.2=zoo2:2888:3888\nserver.3=zoo3:2888:3888\n```\n\nIf you DO NOT want this behaviour and would like the `zoo.cfg` to template the\ninventory_hostname then set `zookeeper_servers_use_inventory_hostname` to `true`\n\n### Default Ports\n\n| Port | Description                         |\n| ---- | ----------------------------------- |\n| 2181 | Client connection port              |\n| 2888 | Quorum port for clustering          |\n| 3888 | Leader election port for clustering |\n\n### Default Directories and Files\n\n| Description                                | Directory / File                            |\n| ------------------------------------------ | ------------------------------------------- |\n| Installation directory                     | `/usr/share/apache-zookeeper-\u003cversion\u003e`     |\n| Symlink to install directory               | `/usr/share/zookeeper`                      |\n| Symlink to configuration                   | `/etc/zookeeper/zoo.cfg`                    |\n| Log files                                  | `/var/log/zookeeper`                        |\n| Data directory for snapshots and myid file | `/var/lib/zookeeper`                        |\n| Data directory for transaction log files   | `/var/lib/zookeeper`                        |\n| Systemd service                            | `/usr/lib/systemd/system/zookeeper.service` |\n| System Defaults                            | `/etc/default/zookeeper`                    |\n\n## Starting and Stopping ZooKeeper services\n\n- The ZooKeeper service can be started via: `systemctl start zookeeper`\n- The ZooKeeper service can be stopped via: `systemctl stop zookeeper`\n\n## Four Letter Word Commands\n\nZooKeeper can use commands based on four letter words, see\n\u003chttps://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_4lw\u003e\n\nThe below example uses the stat command to find out which instance is the leader\n:\n\n```bash\nfor i in 1 2 3 ; do\n  echo \"zookeeper0$i is a \"$(echo stat | nc zookeeper0$i 2181 | grep ^Mode | awk '{print $2}');\ndone\n```\n\n## Dependencies\n\nNo dependencies\n\n## Example Playbook\n\n```yaml\n- hosts: zookeeper-nodes\n  roles:\n    - sleighzy.zookeeper\n```\n\n## Linting\n\nLinting should be done using [ansible-lint]\n\n```sh\npip3 install ansible-lint --user\n\nansible-lint -c ./.ansible-lint .\n```\n\n## Testing\n\nThis module uses the [Ansible Molecule] testing framework. This test suite\ncreates a ZooKeeper cluster consisting of three nodes running within Docker\ncontainers. Each container runs a different OS to test the supported platforms\nfor this Ansible role.\n\nAs per the [Molecule Installation guide] this should be done using a virtual\nenvironment. The commands below will create a Python virtual environment and\ninstall Molecule including the Docker driver.\n\n```sh\n$ python3 -m venv molecule-venv\n$ source molecule-venv/bin/activate\n(molecule-venv) $ pip3 install ansible docker \"molecule-plugins[docker]\"\n```\n\nRun playbook and tests. Linting errors need to be corrected before Molecule will\nexecute any tests. This will run all tests and then destroy the Docker\ncontainers.\n\n```sh\nmolecule test\n```\n\nThe below command can be used to run the playbook without the tests. This can be\nrun multiple times when making changes to the role, and ensuring that operations\nare idempotent.\n\n```sh\nmolecule converge\n```\n\nThe below commands can be used to just run the tests without tearing everything\ndown. The command `molecule verify` can be repeated for each test run.\n\n```sh\nmolecule create\nmolecule converge\nmolecule verify\n```\n\nTear down Molecule tests and Docker containers.\n\n```sh\nmolecule destroy\n```\n\n## License\n\n![MIT license]\n\n[ansible-lint]: https://docs.ansible.com/ansible-lint/\n[ansible molecule]: https://molecule.readthedocs.io/en/latest/\n[lint code base]:\n  https://github.com/sleighzy/ansible-zookeeper/workflows/Lint%20Code%20Base/badge.svg\n[mit license]: https://img.shields.io/badge/License-MIT-blue.svg\n[molecule]:\n  https://github.com/sleighzy/ansible-zookeeper/workflows/Molecule/badge.svg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsleighzy%2Fansible-zookeeper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsleighzy%2Fansible-zookeeper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsleighzy%2Fansible-zookeeper/lists"}