Skip to content

Instantly share code, notes, and snippets.

@dfranciscus
Last active April 9, 2018 00:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dfranciscus/559eb2a71d5b6409186a5391e130e4a1 to your computer and use it in GitHub Desktop.
Save dfranciscus/559eb2a71d5b6409186a5391e130e4a1 to your computer and use it in GitHub Desktop.
Vagrant Puppet lab
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrant multi-machine sample setup
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" | 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" do |puppetagent|
puppetagent.vm.box = "bento/centos-7.2"
puppetagent.vm.network "private_network", ip: "192.168.10.22"
puppetagent.vm.hostname = "puppetagent"
puppetagent.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 --certname 'puppetagent'
SHELL
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment