Forked from dfranciscus/gist:4a9e50ec12748635e9c830e79b41afb8
Last active
May 22, 2018 17:02
-
-
Save dalmosantos/c0971cff4909fa4002b47cf0083582c5 to your computer and use it in GitHub Desktop.
Vagrant Puppet test environment
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 : | |
Vagrant.configure("2") do |config| | |
config.vm.define "puppet" do |puppet| | |
puppet.vm.box = "centos/7" | |
puppet.vm.network "private_network", ip: "192.168.33.100" | |
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.33.101 puppetagent-1" | sudo tee -a /etc/hosts | |
sudo echo "192.168.33.102 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 clean all | |
sudo yum repolist | |
sudo yum -y install ntp | |
sudo timedatectl set-timezone America/Sao_Paulo | |
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 = "centos/7" | |
puppetagent1.vm.network "private_network", ip: "192.168.33.101" | |
puppetagent1.vm.hostname = "puppetagent-1" | |
puppetagent1.vm.provision "shell", inline: <<-SHELL | |
sudo echo "192.168.33.100 puppet" | sudo tee -a /etc/hosts | |
sudo timedatectl set-timezone America/Sao_Paulo | |
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 = "centos/7" | |
puppetagent2.vm.network "private_network", ip: "192.168.33.102" | |
puppetagent2.vm.hostname = "puppetagent-2" | |
puppetagent2.vm.provision "shell", inline: <<-SHELL | |
sudo echo "192.168.33.100 puppet" | sudo tee -a /etc/hosts | |
sudo timedatectl set-timezone America/Sao_Paulo | |
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