
# Copy SSH key to primary node and run scriptsĬonfig.vm.provision "file", source: "~/.vagrant.d/insecure_private_key", destination: "~/.ssh/id_rsa"Ĭonfig.vm.provision :shell, inline: "chmod 600 ~/.ssh/id_rsa", privileged: falseĬonfig.vm.provision :shell, inline: $script, privileged: trueĬonfig. Python3 -m pip install ansible-navigator -userĬonfig.vm.network :private_network, ip: bx # Define three VMs with static private IP addresses.ĭnf -y install python3 python3-pip podman ansible-core It is possible to instruct Vagrant to repeat the instruction multiple times, to create more than one virtual machine.Configure the provider, in this case Virtual Box, with the required settings for our virtual machine(s).I have selected the Centos Stream 8 image available on the Vagrant Box catalogue.

We can add the instruction on which box to use.Firstly, we need to tell Vagrant which version of configuration to use:.You can create your own boxes using a tool like Packer, but Vagrant also provides a catalogue of publicly available boxes. Vagrant has the concept of a box, which is a base image to start provisioning from. Each time we provision a new Virtual Machine, we do not want to perform a fresh installation of the operating system, as this is too time consuming.Open this file in your text editor of choice, I will be using Visual Studio Code. In your working directory, create a new file and name it Vagrantfile.Next we will look at the creation of a Vagrantfile to start our Virtual Machine automation. Make sure Vagrant was successfully installed by running the following from the command-line.



Download and install Oracle Virtual Box (or your preferred Hypervisor).Download and install Visual Studio Code.Visual Studio Code (or another text editor).Vagrant is a tool for creation and management of virtual machines, also using scripts to automate the provisioning process.
