How to Provision a Vagrant Box Using Inline and External Scripts

Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with

Already have an account? Sign In »

2 hours 51 minutes
Video Transcription
Hello. My name is Jasmine Jackson and our courses intro to vagrant. And in this lesson, I will discuss provisioning in vagrant. So let's go.
Are learning objectives for this video are we will learn the definition of provisioning provision steps at vagrant and the difference between an in line and external script. So let's start
Okay, what is provisioning? Provisioning allows you to automatically install software alter configurations and mawr as part of the vagrant up process. So the good thing about provisioning is this process can be automated repeatable,
which is good because all you have to do is create the steps what once and then have it repeat indefinitely. For instance, when you create or destroy a box, this requires no human interaction.
After you have finished your provisioning, you will have a fully configured environment.
So to configure your environment, you can use two options. The first option is shell scripts, and the second option is in the industry standard configuration management systems such as puppet or chef.
For this course, we're going to use shell scripts as this is good for beginners, so provisioning steps provisioning happens in the following steps. First, you create your environment when typing vagrant up.
If your environment is running, you can then use the command vagrant provision.
Or, if you want to reload your environment or machine, you can use the command vagrant, reload,
dashed *** provision
and the reason why we have this dash dash provisioned parameter is that
it forces provisioning on your vagrant machine.
So to start with provisions provisioning, we need to modify the vagrant FAO with the confident divey m dot provisioned command
and just a quick caveat by default. Provisions are only executed once,
but you can specify and the vagrant foul to have the command to run. Always when you do a vagrant up or vagrant reload. Or you can set it in your vagrant file to never run on a vagrant up or vagrant. Reload.
So there are two types of scripts and line in external, so with an in line script, this is directly written into the vagrant foul. With an in line parameter and an external script, we have to specify the path where the script is located,
and then what will happen is vagrant within. Upload the script into
our vagrant machine executed
Quick caveat. If you're using windows. The the external script must be in power show or as a batch foul. If you do not have it in these two
programs, the script will not work.
So now quick quiz. When creating an in line script, a path parameter has to be defined. Is this true, or is this false? I will give you a couple of seconds, and then I will come back with my answer. Let's start now.
And the answer is, but for Berber.
So with the online script, you do not need to specify a path parameter. You specify a path parameter for an external script, so this is false.
So in summary in this video, we discussed the definition of provisioning
provision steps and how it works in vagrant in the difference between in line and external scripts.
So now we have an end of lecture quiz
question. Were writing an external script using Windows? What is an acceptable application to use a Lennix? Be no pair. See power shale or D exhale.
I would give you a couple of seconds, and then I will come back with my answer. Let's start now,
and the answer is but proper bar
C Remember, when using windows and you want to create an external script, it has to be in power shell or as a batch foul. If you put it as any, if you use any other applications than the script will not work. So the answer is C.
So and the next two videos that are coming up, I will provide demos on how to create in line script and how to also create an external scripts. I can't wait to see you in those videos and have a good day bye.
Up Next
Introduction to Vagrant

In this introductory Vagrant training, students will learn Vagrant’s core concepts, how to configure the virtualization tool, and how it will benefit their organizations. Upon completion of the course, students will have a foundational understanding of Vagrant.

Instructed By