Skip to content

Commit

Permalink
Simplify the host inventory file
Browse files Browse the repository at this point in the history
  • Loading branch information
electrocucaracha committed Oct 28, 2024
1 parent f5c7c5c commit 1c73e0f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ etchosts_dict = ""
File.open("#{File.dirname(__FILE__)}/inventory/hosts.ini", "w") do |inventory_file|
inventory_file.puts("[all]")
nodes.each do |node|
inventory_file.puts(node["name"])
inventory_file.puts("#{node['name']}\t\tansible_host=#{node['networks'][0]['ip']}\tip=#{node['networks'][0]['ip']}")
etchosts_dict += "#{node['networks'][0]['ip']}-#{node['name']},"
end
%w[kube-master kube-node etcd qat-node criu].each do |group|
inventory_file.puts("\n[#{group}]")
nodes.each do |node|
inventory_file.puts("#{node['name']}\t\tansible_host=#{node['networks'][0]['ip']}\tip=#{node['networks'][0]['ip']}") if node["roles"].include?(group.to_s)
inventory_file.puts(node["name"]) if node["roles"].include?(group.to_s)
end
end
inventory_file.puts("\n[k8s-cluster:children]\nkube-node\nkube-master")
Expand Down

0 comments on commit 1c73e0f

Please sign in to comment.