Using multiple provisioners on a single project
We can use multiple provisioners within a single project if we wish; we simply need to put them in the order we wish for them to be executed within our Vagrant file. The following command will first run an SSH command before provisioning with Puppet:
Vagrant.configure("2") do |config| Config.vm.box = "ubuntu/trusty64" config.vm.provision "shell", inline: "apt-get update" config.vm.provision "puppet" do |puppet| puppet.manifests_path = "provision/puppet/manifests" puppet.manifest_file = "default.pp" puppet.module_path = "provision/puppet/modules" end end
Using multiple provisioners can be useful, especially if one is more suited at specific tasks than another, or if we require some prerequisites. For example, when using Puppet and Chef in client/server mode, they need to have an SSH key to communicate with the server. We can use a shell provisioner to instruct the VM to download the keys we prepared from a secure...