Created
March 20, 2016 20:18
-
-
Save Aviio/04ce8d162757693a9cae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
<% systems.each do |systems| %> | |
config.vm.define "<%= systems.id %>" do |<%= systems.id %>| | |
<%= systems.id %>.vm.box = "<%= systems.basebox %>" | |
<%= systems.id %>.vm.box_url = "<%= systems.url %>" | |
<% systems.networks.each do |n| %> | |
<% grab_system_number = systems.id.gsub(/[^0-9]/i, "") %> | |
<% n.range[9..9] = grab_system_number %> | |
<%= systems.id %>.vm.network :public_network | |
<%= systems.id %>.vm.network :private_network, :ip => "<%= n.range %>0" | |
<% end %> | |
<%= systems.id %>.vm.synced_folder "<%= MOUNT_DIR %>", "/mount" | |
end | |
config.vm.provision :shell, :inline => "sed -i 's/squeeze/wheezy/g' /etc/apt/sources.list" | |
config.vm.provision :shell, :inline => "apt-get update --fix-missing" | |
# Add secure services | |
<% systems.services.each do |service| %> | |
<% service_name = service.name.gsub!('-', '_').gsub!('.', '_') %> | |
config.vm.provision "puppet" do | <%=service_name%> | | |
<%=service_name%>.module_path = "<%="#{ROOT_DIR}/mount/puppet/module/#{service_name}"%>" | |
<%=service_name%>.manifests_path = "<%="#{ROOT_DIR}/mount/puppet/module/#{service_name}/manifests/"%>" | |
<%=service_name%>.manifest_file = "install.pp" | |
end | |
<% end %> | |
# Add vulnerabilities | |
#a vulnerability has 1 or many puppets | |
<% systems.vulns.each do |vulnerability| %> | |
<% vulnerability_name = vulnerability.name %> | |
config.vm.provision "puppet" do | <%=vulnerability_name%> | | |
<%=vulnerability_name%>.module_path = "<%="#{ROOT_DIR}/mount/puppet/module/#{vulnerability_name}"%>" | |
<%=vulnerability_name%>.manifests_path = "<%="#{ROOT_DIR}/mount/puppet/manifest"%>" | |
<%=vulnerability_name%>.manifest_file = "<%=vulnerability_name%>.pp" | |
end | |
<% end %> | |
# clean up script which clears history from the VMs and clobs files together | |
config.vm.provision "puppet" do |cleanup| | |
cleanup.module_path = "<%="#{ROOT_DIR}/modules/build/puppet/cleanup/module"%>" | |
cleanup.manifests_path = "<%="#{ROOT_DIR}/modules/build/puppet/cleanup"%>" | |
cleanup.manifest_file = "cleanup.pp" | |
end | |
config.vm.provision :shell, :inline => "history -c && history -w" | |
config.vm.provision :shell, :inline => "umount /mount/" | |
end | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment