Created
March 16, 2019 02:28
-
-
Save crissilvaeng/9c1744df2d6216964cf5f72f8a3c01ef to your computer and use it in GitHub Desktop.
Puppet Lab with Vagrant
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 : | |
$script = <<-SCRIPT | |
wget https://apt.puppetlabs.com/puppetlabs-release-pc1-xenial.deb | |
dpkg -i puppetlabs-release-pc1-xenial.deb | |
apt-get update | |
SCRIPT | |
$server = <<-SCRIPT | |
apt-get install puppetserver -y | |
ufw allow 8140 | |
systemctl enable puppetserver | |
systemctl start puppetserver | |
systemctl status puppetserver | |
SCRIPT | |
$agent = <<-SCRIPT | |
apt-get install puppet-agent -y | |
systemctl enable puppet | |
systemctl start puppet | |
systemctl status puppet | |
SCRIPT | |
Vagrant.configure("2") do |config| | |
config.vm.box = "ubuntu/xenial64" | |
config.vm.provision "shell", privileged: true, inline: $script | |
config.vm.provision :hosts do |provisioner| | |
provisioner.add_host "10.0.0.10", ['puppet'] | |
end | |
config.vm.define :puppet do |puppet| | |
puppet.vm.network :private_network, ip: "10.0.0.10" | |
puppet.vm.provision "shell", privileged: true, inline: $server | |
puppet.vm.provider :virtualbox do |vb| | |
vb.memory = 4096 | |
vb.cpus = 2 | |
end | |
end | |
(1..3).each do |i| | |
config.vm.define "node-#{i}" do |node| | |
node.vm.provision "shell", privileged: true, inline: $agent | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Vagrant Hosts plugin is required!
https://github.com/oscar-stack/vagrant-hosts