Skip to content

Instantly share code, notes, and snippets.

@teriyakichild
Last active January 11, 2020 22:53
Show Gist options
  • Save teriyakichild/4675f003ed84be89f245 to your computer and use it in GitHub Desktop.
Save teriyakichild/4675f003ed84be89f245 to your computer and use it in GitHub Desktop.
vagrant file
---
nodes:
- 'zabbix'
- 'postgres'
- 'puppetdb'
network: '10.10.10'
stage { pre: before => Stage[main] }
stage { post: require => Stage[main] }
node 'zabbix' {
include zabbix::agent
}
node 'postgres' {
include profile_postgresql_database
}
node 'puppetdb' {
include profile_puppetdb
}
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'yaml'
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
# Load configuration from config.yml
conf = YAML::load_file('config.yml')
nodes = conf['nodes']
network = conf['network']
puppet_nodes = []
ip_modifier=10
nodes.each { |node_name|
ip_modifier += 1
# puppet_nodes << {:hostname => node_name, :ip => "#{network}.#{ip_modifier}", :box => 'http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-puppet.box'}
puppet_nodes << {:hostname => node_name, :ip => "#{network}.#{ip_modifier}", :box => 'hashicorp/precise64'}
}
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
if Vagrant.has_plugin?("vagrant-cachier")
# Configure cached packages to be shared between instances of the same base box.
# More info on the "Usage" link above
config.cache.scope = :box
end
puppet_nodes.each do |node|
config.vm.define node[:hostname] do |node_config|
node_config.vm.box = node[:box]
node_config.vm.host_name = node[:hostname]
config.vm.network "private_network", ip: node[:ip]
memory = node[:ram] ? node[:ram] : 1024;
node_config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", memory.to_s]
vb.customize ["modifyvm", :id, "--name", node[:hostname]]
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
end
end
end
config.vm.provision "puppet" do |puppet|
puppet.module_path = "modules"
puppet.manifests_path = "manifests"
puppet.manifest_file = "site.pp"
puppet.options = "--verbose --debug"
puppet.facter = {
"vagrant" => "1",
"tier" => 'staging',
"region" => 'us',
"fqdn" => 'tonyrogers.me',
# "pwsafe_clear_cache" => 'true',
}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment