Make slaves connecting to first node
This commit is contained in:
parent
d8c10ad901
commit
c8cd47ff6d
|
@ -38,11 +38,17 @@ module VagrantPlugins
|
|||
end
|
||||
|
||||
primary_machine_ip = get_ip.(primary_machine)
|
||||
if get_ip.(machine) == primary_machine_ip
|
||||
entry = TemplateRenderer.render("guests/coreos/etcd.service")
|
||||
current_ip = get_ip.(machine)
|
||||
if current_ip == primary_machine_ip
|
||||
entry = TemplateRenderer.render("guests/coreos/etcd.service", :options => {
|
||||
:my_ip => current_ip
|
||||
})
|
||||
else
|
||||
entry = TemplateRenderer.render("guests/coreos/etcd.service",
|
||||
:options => {:connect_to => primary_machine_ip})
|
||||
connection_string = "#{primary_machine_ip}:7001"
|
||||
entry = TemplateRenderer.render("guests/coreos/etcd.service", :options => {
|
||||
:connection_string => connection_string,
|
||||
:my_ip => current_ip
|
||||
})
|
||||
end
|
||||
|
||||
puts entry
|
||||
|
|
|
@ -4,7 +4,7 @@ Description=Clustered etcd
|
|||
|
||||
[Service]
|
||||
Restart=always
|
||||
ExecStart=/usr/bin/etcd -c 4001 -s 7001 <% if options[:connect_to] %>-C <%= options[:connect_to] %>:7001<% end %> -d /home/core/etcd
|
||||
ExecStart=/usr/bin/etcd -c 4001 -s 7001 -h <%= options[:my_ip] %> <% if options[:connection_string] %>-C <%= options[:connection_string] %><% end %> -d /home/core/etcd
|
||||
|
||||
[Install]
|
||||
WantedBy=local.target
|
||||
|
|
Loading…
Reference in New Issue