Ruby class for generating VyOS config

Hi,

While writing a Dual Stack VyOS configuration generator, I ended up writing a ruby class, to make generating VyOS configurations easier. Sharing here incase someone else likes Ruby and are interested in automatically generating configs.

Configuration is created by chaining method calls together and then assigning values. It can output either configuration or a series of set commands.

For example the following ruby commands:

config = VyOSConfig.new
config.interfaces.ethernet('eth0').address = ['192.0.2.1/24', '2001:db8::ffff/64']
puts config.to_s

Results in the following configuration being generated:

interfaces {
    ethernet eth0 {
        address '192.0.2.1/24'
        address '2001:db8::ffff/64'
    }
}
1 Like

we need some contrib repo for all such things
@dmbaturin what you think?