how to create record (host) in infoblox with ruby

142 Views Asked by At

Does anyone have experience with ruby infoblox gem? I am trying to create and delete records in Infoblox.

I can get next available ip from infoblox, but that's about it. Cannot figure out how to create and delete hosts.

Please advise, Thanks...

connection = Infoblox::Connection.new(username: 'myuser', password: 'mypasswd', host: 'infoblox(IP)', ssl_opts: {verify: false})

network = Infoblox::Network.find(connection, network: '192.168.0.0/24').first

ip = network.next_available_ip.inspect.
1

There are 1 best solutions below

0
On

require 'infoblox'

connection = Infoblox::Connection.new(username: 'username', password: 'passwd', host: 'infoblox ip', ssl_opts: {verify: false})

network = Infoblox::Network.find(connection, network: '192.168.0.1/24').first

ip = network.next_available_ip.inspect

puts ip.to_s.delete!('[]""')

host = Infoblox::Host.new( connection: connection, name: data[:hostname], ipv4addrs: [{ipv4addr: ip}]) host.post