Skip to content

Commit

Permalink
Update hosts-cluster with proper virtual IP
Browse files Browse the repository at this point in the history
  • Loading branch information
matrixik committed Apr 12, 2017
1 parent a3d7ea4 commit 0031da9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
14 changes: 8 additions & 6 deletions chef/cookbooks/monasca/libraries/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,18 @@ def get_host_for_monitoring_url(node)
).address
end

def network_settings(node)
@ip ||= Chef::Recipe::Barclamp::Inventory.get_network_by_type(
def get_vip_for_monitoring_cluster(node)
CrowbarPacemakerHelper.cluster_vip(
node, "monitoring"
).address
)
end

def network_settings(node)
@ip ||= get_host_for_monitoring_url(node)
@cluster_monitoring_ip ||= nil

if node[:monasca][:ha][:enabled] && !@cluster_monitoring_ip
@cluster_monitoring_ip = CrowbarPacemakerHelper.cluster_vip(
node, "monitoring"
)
@cluster_monitoring_ip = get_vip_for_monitoring_cluster(node)
end

if node[:monasca][:ha][:enabled]
Expand Down
4 changes: 4 additions & 0 deletions chef/cookbooks/monasca/recipes/master.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
"monasca-hosts-cluster.erb"
end

monasca_node = search(:node, "roles:monasca-server")[0]
monitoring_vip = MonascaHelper.get_vip_for_monitoring_cluster(monasca_node)

template "/opt/monasca-installer/monasca-hosts" do
source hosts_template
owner "root"
Expand All @@ -43,6 +46,7 @@
variables(
monasca_host: monasca_hosts[0],
monasca_hosts: monasca_hosts,
monitoring_vip: monitoring_vip,
ansible_ssh_user: "root",
keystone_host: keystone_settings["public_url_host"]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ localhost ansible_connection=local
keystone-node ansible_ssh_host=<%= @keystone_host %> ansible_ssh_user=<%= @ansible_ssh_user %>

# Load balancer hosts
# TODO
#monasca-log-api-balancer-node ansible_ssh_host= ansible_ssh_user=<%= @ansible_ssh_user %>
#monasca-api-balancer-node ansible_ssh_host= ansible_ssh_user=<%= @ansible_ssh_user %>
#kibana-balancer-node ansible_ssh_host= ansible_ssh_user=<%= @ansible_ssh_user %>
monasca-log-api-balancer-node ansible_ssh_host=<%= @monitoring_vip %> ansible_ssh_user=<%= @ansible_ssh_user %>
monasca-api-balancer-node ansible_ssh_host=<%= @monitoring_vip %> ansible_ssh_user=<%= @ansible_ssh_user %>
kibana-balancer-node ansible_ssh_host=<%= @monitoring_vip %> ansible_ssh_user=<%= @ansible_ssh_user %>

# ElasticSearch nodes for cluster
<% @monasca_hosts.each_with_index do |host, index| %>
Expand Down Expand Up @@ -78,8 +77,7 @@ keystone-node ansible_ssh_host=<%= @keystone_host %> ansible_
<% end %>

# Load balancer node
# TODO
#balancer-node ansible_ssh_host= ansible_ssh_user=<%= @ansible_ssh_user %>
balancer-node ansible_ssh_host=<%= @monitoring_vip %> ansible_ssh_user=<%= @ansible_ssh_user %>

#Storm Nimbus nodes
<% @monasca_hosts.each_with_index do |host, index| %>
Expand Down Expand Up @@ -110,8 +108,7 @@ monasca-thresh-node ansible_ssh_host=<%= @monasca_host %> ansible_s
<% end %>

# Keepalived nodes
# TODO
#keepalived-virtual-node ansible_ssh_host= ansible_ssh_user=<%= @ansible_ssh_user %>
keepalived-virtual-node ansible_ssh_host=<%= @monitoring_vip %> ansible_ssh_user=<%= @ansible_ssh_user %>

<% @monasca_hosts.each_with_index do |host, index| %>
<%= "keepalived-node-#{index} ansible_ssh_host=#{host}" %> ansible_ssh_user=<%= @ansible_ssh_user %>
Expand Down

0 comments on commit 0031da9

Please sign in to comment.