Skip to content

Instantly share code, notes, and snippets.

@fatmcgav
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fatmcgav/b8647138f740f4c2e839 to your computer and use it in GitHub Desktop.
Save fatmcgav/b8647138f740f4c2e839 to your computer and use it in GitHub Desktop.
etcd cluster dev env
---
# etcd config
etcd::peers:
- 'etcd-node1:7001'
- 'etcd-node2:7001'
- 'etcd-node3:7001'
class dev {
# Require the base config module
require base
node /^etcd/ {
include dev::etcd_node
}
}
class dev::etcd_node {
# Setup etcd
class { '::etcd':
package_ensure => 'latest',
}
}
---
:backends:
- yaml
:yaml:
:datadir: /vagrant/puppet/hieradata
:hierarchy:
- "nodes/%{::clientcert}"
- "os/%{::operatingsystem}"
- "common/common"
# -*- mode: ruby -*-
# vi: set ft=ruby :
#Get hostname
hostname = Socket.gethostname.downcase!
Vagrant.configure("2") do |config|
# Server hash
etcd_servers = { "etcd-node1.#{hostname}.local" => '192.168.250.20',
"etcd-node2.#{hostname}.local" => '192.168.250.21',
"etcd-node3.#{hostname}.local" => '192.168.250.22'
}
# Set the base box to use
config.vm.box = "CentOS-6.3-x86_64-minimal"
# Set default box memory
config.vm.provider :virtualbox do |vb|
# Use VBoxManage to customize the VM. For example to change memory:
vb.customize ["modifyvm", :id, "--memory", "1024"]
end
# Create required servers
etcd_servers.each do |server_name, server_ip|
config.vm.define server_name do |server_config|
# Set hostname and private network
server_config.vm.hostname = server_name
server_config.vm.network :private_network, ip: server_ip
end
end
# Remove existing Yum repos
config.vm.provision "shell", inline: "rm -rf /etc/yum.repos.d/*.repo"
# Provision using Puppet
config.vm.provision "puppet" do |puppet|
puppet.manifests_path = "puppet/manifests"
puppet.module_path = "puppet/modules"
puppet.hiera_config_path = "puppet/hieradata/hiera.yaml"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment