Skip to content

Instantly share code, notes, and snippets.

@jeffrafter
Created March 23, 2012 16:23
Show Gist options
  • Select an option

  • Save jeffrafter/2172431 to your computer and use it in GitHub Desktop.

Select an option

Save jeffrafter/2172431 to your computer and use it in GitHub Desktop.
#----------------------------------------------------------------------
# Vagrant quirks
#----------------------------------------------------------------------
# Vagrant has Ruby in /opt/ruby/bin, but it is not available to `sudo`
# by default. We need to do some sed-fu here in order to enable that.
# This better mimicks production. Ideally, however, we would have a base
# box that exactly mimics production.
if node[:environment] == "development"
node[:sudo][:options] << "!secure_path"
end
...
# If we're in Vagrant, then we need to make sure the Vagrant user has
# sudo priveleges
sudo_user "vagrant" if node[:instance_role] == "vagrant"
...
# Reject all other traffic.
if !in_vagrant?
iptables_rule "9_reject_all" do
source "iptables.reject_all.erb"
end
else
Chef::Log.info("In vagrant, not setting up iptables for rejecting all.")
end
# This provides a simple test of whether we're in a development
# environment.
def in_vagrant?
node[:instance_role] == "vagrant"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment