sleighzy/ansible-zookeeper

Custom location for `zoo.cfg.j2` template or change ansible_nodename

Closed this issue · 1 comments

Hello Simon,

I'm trying not to change the downloaded role as this might make it harder to keep it in sync w/ the future versions.

We have an inventory like:

---
zk_cluster_devel:
  hosts:
    "zk-cluster-[01:03].example.com":
      provider: aws
      ......................

As seen above the machine is in AWS and the default hostname is generated in the form ip-internal-ip which is not valid as it does not resolve to anything.
I tried inventory_hostname but it added zk-cluster-01.example.com and then ZK complained w/ "Have smaller server identifier, so dropping the connection".

The only viable solution was hostvars[host].ansible_all_ipv4_addresses[0].
(I would have tried ansible_default_ipv4 but the article https://medium.com/opsops/ansible-default-ipv4-is-not-what-you-think-edb8ab154b10 discouraged me.)

I'll make the PR, but I would like to know what path would you like me to take:

Thanx!

Satisfied by #38.