So friends let's walk through the solution now. So what I will do is I'll
create a playbook
and I'll just call this one let's just say LVM conf dot yml. So we're going to
insert mode,
have our three hyphens at the top, let's get this playbook in name, and I'll
just say configure LVM.
Now here we're going to target, we're going to target the test group. And in
this case here I'm
going to set gather facts to be false, we don't actually need them, so why use
them. Now the very
first thing that I'm going to have to do is to create a volume group. So let me
just check
something if I go into my device number one right here, if I just send LSBLK
dash f, we can actually WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
dash f, we can actually
see here I have this disk right here, NVMe0n2, this is the disk that I'm going
to target and
effectively put into my volume group. So let's just escape back out, go back
into my playbook,
and now I'll begin defining my tasks. Okay, so I'll give this task in name, and
I'll just say
creates a volume group. Now here's what I want to do, I want to utilize a very
particular module.
So if I say Ansible.doc dash dash list to see all of my available modules that
I have right here,
if I do a forward slash and I search for LVG and then hit end to go to the next WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
if I do a forward slash and I search for LVG and then hit end to go to the next
, we can see here I
have this module community general LVG that sounds like it might be what we
want. So what I will do
here is just copy this, okay, grab here, I'll press Q to quit, let's close the
screen and I'll
say Ansible.doc and just paste it in that particular module. Now it says here
this module creates,
removes or resizes volume groups, that sounds like exactly what we would like
to do. So
if you go down to the bottom here, we should see some examples. So we've got
some keywords such as
VG allows us to specify the actual volume group we want to create. PBS allows WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
VG allows us to specify the actual volume group we want to create. PBS allows
us to specify which
physical devices we want to belong to this particular volume group. And this
seems like kind of what
we want to do. So let's just go and grab one of these examples right here, to
copy this right here,
press Q to quit, let's go back in to my playbook right here. And all I will do
is I'm going to
insert mode or to paste this example in. Now if I just fix the indentation here
, and all I will do
is I'll get rid of this name right here. Okay, so like I say VG is going to
allow us to specify
what our volume group is actually called, and it should actually be called nug
get storage I believe, WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
get storage I believe,
let me just double check that. Yep, nugget storage right there. Now I specify
my physical volumes I
want to use. So in my case here, it's going to be dev nvm e zero n two. Now if
this is a different
value for you on your machine, by all means putting the correct value. So that
should create our
volume group, what we now want to do is to create a logical volume within. So I
'm just going right
this correctly. There we go. And once again, if I am to list by modules, if I
just do forward slash
and I begin searching for logical and to enter, we can see here in the WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
and I begin searching for logical and to enter, we can see here in the
description for this particular
module, this is going to configure an LVM volume and we can't have to see the
details. So let's go
in to the actual module itself. Let's copy here, press Q to quit, once you
answer the dot and paste
in this module, so let's go in here. It says here, this is going to allow us to
create, remove or
resize logical volumes bingo. This is exactly what you want. So again, you can
go through all of the
parameters, how to use this particular module, but again, one of the best ways
to do so any time
driven situation is to look at the examples right here and see if it actually
helps us. So we can WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
helps us. So we can
see here as per the example, this is going to allow us to create a logical
volume of 512 megs.
So let's grab this as a general little template right here, copy a year and I
'll just press Q to
quit, go back into my little playbook here, going to insert mode and I'll just
paste in this particular
one and all I'll do is just fix the indentation once again. Okay, so let's just
fix some of the
details here, we're going to create a logical volume of let's maybe say 100 me
gs and what is the
volume group I want to use? Well, I want to use the nuggets storage volume
group that I just created
above and the logical volume here should actually be called vol one as per the WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
above and the logical volume here should actually be called vol one as per the
instructions and it
should be of the size 100 megs. Let's just say 100. So let's just copy this
here since we have
this configured and let's go all the way to the margin and we'll just paste
this in and it should
keep the same indentation as we see right here. Let's just go modify these
details changes to 200.
The same volume group should be targeted this time though the new logical
volume should be called
vol two and it should be of size 200 megs. So that is going to allow us to
create our volume
group as well as our logical volumes. What we now want to do is we want to WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
group as well as our logical volumes. What we now want to do is we want to
effectively put a
file system on both of these volumes. The first one should get ext4 and the
second one should get
XFS. So once again, if I just go to my answerable documentation, if I do a
forward slash and I set
for file system and the answer hit the letter n to go to the next one. And
again, we can see here
this particular module here is going to make a file system. So community
general file system,
let's grab this one right here then. So it'll say answerable dash dot paste
this in and hit enter
we see this is going to create a file system and again we have access to all of WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
we see this is going to create a file system and again we have access to all of
the available
options that we need. Now let's just go down to some examples right here again.
Let's grab this
particular example right here. Okay, let's just copy this press Q to quit. Let
's go back into our
playbook and scroll all the way down. Let's go to the margin once again and
just paste this in and
now let's just fix our indentation. So the first thing I will do is create the
ext4 file system
on vol one. So the file system type is going to be ext4. Now the actual device
here the way you can
actually reference this if you recall with respect to LVM is we say forward WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
actually reference this if you recall with respect to LVM is we say forward
slash dev to get the
device no changes there. And then inside of this we're going to have our volume
group which in this
case here is nugget storage. So I would say nugget storage and then inside of
here we specify the
actual logical volume which in this case here is just vol one. So we say vol
one and this can be
a path right here. So let's go and actually put this in then so back into
insert mode and we'll
just say nugget storage and then I'll say vol one and all that we'll do is I'll
copy all of this
right here again copy it let's go to the margin and just paste this in again WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
right here again copy it let's go to the margin and just paste this in again
make the modifications
I'll just say create XFS. I should actually add file system on this to make it
a little bit
more descriptive XFS file system on vol number two. So all I will do is modify
the values this
will maybe XFS and this particular path will be changed to vol number two. So
if I just save this
and all I will do is I'll say answer my playbook LVM conf and hit enter give it
a moment we create
the VG and then the logical volumes and then create the file systems. Now what
I will do is I'll go
enter my device let's say device number one and if I do an LSBLK-F we can WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
enter my device let's say device number one and if I do an LSBLK-F we can
actually see here
we have our storage as our LVM storage on this particular disk we have the nug
get story volume one
it is an ext4 based file system whereas the volume two actually is an XFS based
file system and once
again if I say so though LVS we can see we have our volume group with the
logical volume within
volume one and it is of size 100 meg whereas the second logical volume volume
two within the
nugget story volume group has a size of 200 meg. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
nugget story volume group has a size of 200 meg.