Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@dfranciscus
Created January 4, 2018 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save dfranciscus/4a9e50ec12748635e9c830e79b41afb8 to your computer and use it in GitHub Desktop.
Save dfranciscus/4a9e50ec12748635e9c830e79b41afb8 to your computer and use it in GitHub Desktop.
Vagrant Puppet test environment
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.define "puppet" do |puppet|
puppet.vm.box = "bento/centos-7.2"
puppet.vm.network "private_network", ip: "192.168.10.21"
puppet.vm.hostname = "puppet"
puppet.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "4096"]
vb.customize ["modifyvm", :id, "--cpus", "2"]
end
puppet.vm.provision "shell", inline: <<-SHELL
sudo echo "192.168.10.22 puppetagent-1" | sudo tee -a /etc/hosts
sudo echo "192.168.10.23 puppetagent-2" | sudo tee -a /etc/hosts
sudo systemctl enable firewalld
sudo systemctl start firewalld
sudo firewall-cmd --permanent --zone=public --add-port=8140/tcp
sudo yum -y install ntp
sudo timedatectl set-timezone America/New_York
sudo systemctl start ntpd
sudo firewall-cmd --add-service=ntp --permanent
sudo rpm -ivh https://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm
sudo yum -y install puppetserver
sudo touch /etc/puppetlabs/puppet/autosign.conf
sudo echo "*" | sudo tee -a /etc/puppetlabs/puppet/autosign.conf
sudo firewall-cmd --reload
sudo systemctl enable puppetserver
sudo systemctl start puppetserver
SHELL
end
config.vm.define "puppetagent-1" do |puppetagent1|
puppetagent1.vm.box = "bento/centos-7.2"
puppetagent1.vm.network "private_network", ip: "192.168.10.22"
puppetagent1.vm.hostname = "puppetagent-1"
puppetagent1.vm.provision "shell", inline: <<-SHELL
sudo echo "192.168.10.21 puppet" | sudo tee -a /etc/hosts
sudo timedatectl set-timezone America/New_York
sudo rpm -ivh https://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm
sudo yum -y install puppet-agent
sudo /opt/puppetlabs/bin/puppet agent --test
SHELL
end
config.vm.define "puppetagent-2" do |puppetagent2|
puppetagent2.vm.box = "bento/centos-7.2"
puppetagent2.vm.network "private_network", ip: "192.168.10.23"
puppetagent2.vm.hostname = "puppetagent-2"
puppetagent2.vm.provision "shell", inline: <<-SHELL
sudo echo "192.168.10.21 puppet" | sudo tee -a /etc/hosts
sudo timedatectl set-timezone America/New_York
sudo rpm -ivh https://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm
sudo yum -y install puppet-agent
sudo /opt/puppetlabs/bin/puppet agent --test
SHELL
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment