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
Required fields are marked with an *
or
Already have an account? Sign In »

Video Transcription
00:00
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.
00:10
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
00:24
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,
00:42
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.
00:58
After you have finished your provisioning, you will have a fully configured environment.
01:03
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.
01:19
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.
01:34
If your environment is running, you can then use the command vagrant provision.
01:42
Or, if you want to reload your environment or machine, you can use the command vagrant, reload,
01:51
dashed *** provision
01:53
and the reason why we have this dash dash provisioned parameter is that
02:00
it forces provisioning on your vagrant machine.
02:05
So to start with provisions provisioning, we need to modify the vagrant FAO with the confident divey m dot provisioned command
02:15
and just a quick caveat by default. Provisions are only executed once,
02:21
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.
02:39
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,
02:58
and then what will happen is vagrant within. Upload the script into
03:02
our vagrant machine executed
03:07
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
03:17
programs, the script will not work.
03:23
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.
03:39
And the answer is, but for Berber.
03:45
False.
03:46
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.
03:59
So in summary in this video, we discussed the definition of provisioning
04:03
provision steps and how it works in vagrant in the difference between in line and external scripts.
04:11
So now we have an end of lecture quiz
04:14
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.
04:28
I would give you a couple of seconds, and then I will come back with my answer. Let's start now,
04:33
and the answer is but proper bar
04:40
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.
04:59
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
Similar Content