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