Skip to content

Commit

Permalink
Added README for how to use zookeeper_use_servers_inventory_hostname
Browse files Browse the repository at this point in the history
  • Loading branch information
ObjectiveTruth committed Jul 25, 2022
1 parent 93be9e5 commit e66edb4
Showing 1 changed file with 59 additions and 20 deletions.
79 changes: 59 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,65 @@ See <https://github.com/ansible/ansible/issues/71528> for more information.

## Role Variables

| Variable | Default |
| ----------------------- | ----------------------------------------------------------------- |
| zookeeper_mirror | <http://www-eu.apache.org/dist/zookeeper> |
| zookeeper_version | 3.7.1 |
| zookeeper_package | apache-zookeeper-{{ zookeeper_version }}-bin.tar.gz |
| zookeeper_group | zookeeper |
| zookeeper_user | zookeeper |
| zookeeper_root_dir | /usr/share |
| zookeeper_install_dir | '{{ zookeeper_root_dir}}/apache-zookeeper-{{zookeeper_version}}' |
| zookeeper_dir | '{{ zookeeper_root_dir }}/zookeeper' |
| zookeeper_log_dir | /var/log/zookeeper |
| zookeeper_data_dir | /var/lib/zookeeper |
| zookeeper_data_log_dir | /var/lib/zookeeper |
| zookeeper_client_port | 2181 |
| zookeeper_id | 1 |
| zookeeper_leader_port | 2888 |
| zookeeper_election_port | 3888 |
| zookeeper_servers | zookeeper-nodes |
| zookeeper_environment | "JVMFLAGS": "-javaagent:/opt/jolokia/jolokia-jvm-1.6.0-agent.jar" |
| zookeeper_firewalld | false |
| Variable | Default | Comment |
|------------------------------------------|-------------------------------------------------------------------|-----------------------------------------------------------------|
| zookeeper_mirror | <http://www-eu.apache.org/dist/zookeeper> ||
| zookeeper_version | 3.7.1 ||
| zookeeper_package | apache-zookeeper-{{ zookeeper_version }}-bin.tar.gz ||
| zookeeper_group | zookeeper ||
| zookeeper_user | zookeeper ||
| zookeeper_root_dir | /usr/share ||
| zookeeper_install_dir | '{{ zookeeper_root_dir}}/apache-zookeeper-{{zookeeper_version}}' ||
| zookeeper_dir | '{{ zookeeper_root_dir }}/zookeeper' ||
| zookeeper_log_dir | /var/log/zookeeper ||
| zookeeper_data_dir | /var/lib/zookeeper ||
| zookeeper_data_log_dir | /var/lib/zookeeper ||
| zookeeper_client_port | 2181 ||
| zookeeper_id | 1 | Unique per server and shoould be declared in the inventory file |
| zookeeper_leader_port | 2888 ||
| zookeeper_election_port | 3888 ||
| zookeeper_servers | zookeeper-nodes | See below |
| zookeeper_use_servers_inventory_hostname | false | See below |
| zookeeper_environment | "JVMFLAGS": "-javaagent:/opt/jolokia/jolokia-jvm-1.6.0-agent.jar" ||
| zookeeper_firewalld | false ||

## Inventory and zookeeper_servers variable

zookeeper_servers variable above accepts a list of inventory node names. These will be used in the `zoo.cfg` to
configure a multi-server cluster so the nodes can find each other. By default, the hostname used in the `zoo.cfg` will
be the hostname reported by the `hostname` command on the server(provided by the ansible_nodename variable). See the
example below.

Assuming the following inventory file and assuming the hostname command for each only gives the hostname without the
domain part

```ini
[zookeeper-nodes]
zoo1.foo.com zookeeper_id=1 #hostname command returns "zoo1"
zoo2.foo.com zookeeper_id=2 #hostname command returns "zoo2"
zoo3.foo.com zookeeper_id=3 #hostname command returns "zoo3"
```
And assuming the following role variables:
```yaml
...
- role: edgefotwaresolutions.zookeeper
zookeeper_servers:
- zoo1.foo.com
- zoo2.foo.com
- zoo3.foo.com
```
The `zoo.cfg` will template the following(Assuming all other defaults)
```ini
server.1=zoo1:2888:3888
server.2=zoo2:2888:3888
server.3=zoo3:2888:3888
```


If you DO NOT want this behaviour and would like the `zoo.cfg` to template the inventory_hostname then set
`zookeeper_use_servers_inventory_hostname` to `true`


### Default Ports

Expand Down

0 comments on commit e66edb4

Please sign in to comment.