andrewrothstein / ansible-etcd

MIT License
4 stars 8 forks source link

etcd.conf gen problem #3

Open Blaiserman opened 6 years ago

Blaiserman commented 6 years ago

The etcd did not start because the ETCD_INITIAL_CLUSTER option in /etc/etcd/etcd.conf file use the same IP for all nodes.

andrewrothstein commented 6 years ago

that doesn't sound right. can you share some details of your setup so that I can help you debug it?

Blaiserman commented 6 years ago

I created 3 vm in virtualbox for kubernetes with vagrant (ubuntu 16.04). There is 2 interface in the vms. One for vagrant (NAT interface) one for public usage (bridged interface). In ansible's hosts file I am using the IP of the bridged interfaces. The role use the default interface's IP. (NAT interface) All nat interface has the same IP. So I could solve the problem like this:

etcd_public_address : "{% if etcd_use_ips %}{{hostvars[inventory_hostname]['ansible_ssh_host']}}{% else %}{{inventory_hostname}}{% endif %}"

etcd_cluster: "{% for host in groups[etcd_master_group_name] %}{{hostvars[host]['inventory_hostname']}}={{etcd_scheme}}://{% if etcd_use_ips %}{{hostvars[host]['ansible_ssh_host']}}{% else %}{{host}}{% endif %}:2380{% if not loop.last %},{% endif %}{% endfor %}" 

But there is another problem: /var/lib/etcd/test-cluster-name.etcd folder not created.