convert netmask to cidr
I'm trying to configure puppet to setup keepalived. As part of this I need to get the netmask of an ip in CIDR notation. I can use the fact $::netmask_eth0 to get a netmask like 255.255.255, but the keepalived configuration file requires /24 notation.
I found the ruby gen NetAddr::CIDR looks like it could do the job, but I don't appear to be able to invoke that from inside a puppet inline_template even though "gem list netaddr" shows it installed.
Any guidance or ideas?