blob: add9ae18f54a888eea1f4ba753a9dcbda92b456d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
#!/bin/bash
id={{ zk_start_myid }}
for i in `echo "{{ ansible_play_hosts }}" | grep -E -o "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+"`
do
ip=`echo $i | grep -E -o "[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+"`
echo 'server.'$id'='$ip':2888:3888' >> {{ install_path }}/{{ zookeeper_version }}/conf/zoo.cfg
if [[ $ip == {{ inventory_hostname }} ]];then
echo $id > {{ install_path }}/{{ zookeeper_version }}/data/myid
fi
((id++))
done
|