Skip to content
Snippets Groups Projects

WIP: Remove the hard coded floating ip address

2 files
+ 13
4
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 10
3
# -*- mode: ruby -*-
# vi: set ft=ruby :
def get_ssh_host_ip(floating_ip)
ip_byte_array = floating_ip.split(".")
return '164.111.161.'+ ip_byte_array[3]
end
Vagrant.configure("2") do |config|
ips = `openstack floating ip list -c "Floating IP Address" -f value`
puts ips
ip_array = ips.split(' ')
config.ssh.username = 'centos'
config.vm.allowed_synced_folder_types = [:rsync]
#config.ssh.private_key_path = "~/.ssh/id_rsa.pub"
@@ -28,12 +35,12 @@ Vagrant.configure("2") do |config|
config.vm.define "ohpc" do |ohpc|
ohpc.ssh.host = '164.111.161.145'
ohpc.ssh.host = get_ssh_host_ip(ip_array[0])
ohpc.vm.hostname = "ohpc"
ohpc.vm.provider :openstack do |ohpc|
ohpc.server_name = 'ohpc'
ohpc.floating_ip = "192.168.16.145"
ohpc.floating_ip = ip_array[0]
ohpc.image = 'CentOS-7-x86_64-GenericCloud-1905'
end
end
Loading