Skip to content

Instantly share code, notes, and snippets.

@mattpascoe
mattpascoe / baseiptemplate
Created October 3, 2012 16:24 — forked from opennetadmin/baseiptemplate
Puppet template to calculate the base subnet IP from an IP/MASK input
<%
# This portion simply calculates the baseip from the ip/mask
baseip=""
addr_parts = scope.lookupvar("ipaddress").split('.')
mask_parts = scope.lookupvar("netmask").split('.')
addr_parts.zip((0..addr_parts.size).to_a).map do |n,i|
baseip += (n.to_i & mask_parts[i].to_i).to_s + "."
end
baseip = baseip[0..-2]
-%>
@mattpascoe
mattpascoe / Vagrantfile
Last active March 3, 2016 23:20 — forked from opennetadmin/Vagrantfile
Simple Vagrant config file. It will get you a precise64 box and start up a puppet run using bridged networking
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "precise64"
# Set a hostname
config.vm.host_name = "ona-vm"