๐๐ ๏ธ DevOps 2.1: Provisioning in Vagrant
"Automate Your Environment: DevOps 2.2 Explores Vagrant Provisioning! ๐๐ฆ"
Table of contents
What is Provisioning?
Provisioning in Vagrant is the process of setting up and configuring a virtual machine automatically. It involves tasks like installing software, configuring settings, and preparing the VM to be in a desired state. This automation simplifies the setup of development environments, ensuring consistency and reducing manual effort.
Let's do some testing:
Add the below code to your vagrant file:
config.vm.provision "shell", inline: <<-SHELL
yum install httpd wget unzip git -y
mkdir /opt/devopsdir
free -m
uptime
SHELL
This will install all the things necessary while booting up - And your vagrant file may look something like this:
Vagrant.configure("2") do |config|
config.vm.box = "jacobw/fedora35-arm64"
config.vm.network "private_network", ip: "192.168.56.12"
config.vm.provider "vmware_desktop" do |vmware|
vmware.gui = true
vmware.allowlist_verified = true
end
config.vm.provision "shell", inline: <<-SHELL
yum install httpd wget unzip git -y
mkdir /opt/devopsdir
free -m
uptime
SHELL
end
And do vagrant up
in your terminal where the vagrant file is present.
As you can see all the services have been downloaded and the output for free and uptime is also shown.
NOTE: Provisioning only happens once. If we do vagrant reload
again it will not happen again.
You can do vagrant provision
or use the --provision
flag to do the provision again.
Conclusion:
In the world of Vagrant, provisioning emerges as the magician's wand. With a few lines of code, it brings software installations, configurations, and setups to life. As we bid farewell to this provisioning chapter, we embrace the power it holds in automating our environments, making development smoother and deployments more reliable. Let's keep provisioning our way to DevOps excellence! ๐ช๐