Vagrant with puppet node provisioning using shell script and puppet modules for Gerrit, Zuul, Jenkins and JIRA.
Tested with Linux (Debian Jessie)
Prerequisite:
- Vagrant
- Virual Box.
Here we are provisioning three virtual machines into virtual box using vagrant, follow the below instructions to provisioning.
- Chnage directory where Vagrantfile is placed.
- Ensure that both puppet-master.sh and puppet-agent.sh is present in same location.
Make the below necessary changes in Vagranfile (if required e.g if you want to change ip addresses for nodes)
#####1. For Master VM:
config.vm.define "master" do |master| master.vm.network "private_network", ip: "192.168.35.1" master.vm.provision "shell", path: "puppet-master.sh", args: "-m 'master' -h '192.168.35.1' -a '192.168.35.2 192.168.35.3'"
Description:
- -m : master host name.
- -h : master host IP.
- -a : agent nodes (Required for autosign certificate)
#####2. For Agent VM
config.vm.define "agent1" do |agent1| agent1.vm.network "private_network", ip: "192.168.35.2" agent1.vm.provision "shell", path: "puppet-agent.sh", args: "agent1 192.168.35.2 master 192.168.35.1" end
- puppet-master.sh : for puppet master installation and configuration while provisioning VM.
- puppetagent.sh : for puppet agent installation and configuration while provisioning.
###How to run:
Use below command for provision VMs in single shot with vagrant (first time it will take time because it will need to download the linux box).
vagrant up
Once it is finished successfully, check the status using below command
vagrant global-status
Now we can login the VM, using below command
vagrant ssh master
we can provide VM id otherwise VM name while login to instance
In puppet we need to make main site.pp into "/etc/puppet/manifiest/site.pp", which will consider module distribution by agent, look into below code for sam.
node 'agent1.example.com'{ include gerrit class { 'jenkins::slave': masterurl => 'http://agent3.example.com:8080', ui_user => 'adminuser', ui_pass => 'adminpass', } } node 'agent2.example.com'{ include jenkins include jenkins::master }
###Modules
- Gerrit
- Jenkins master and slave
- Zuul
- JIRA