Ansible Modules
Ansible modiies are the ones that are used to perform the task on the managed nodes.
some of the modules are platform dependent such as yum (RHEL - flavor).
Some of the popular modules are:-
parted - to create partitions on our hard disks
filesystem - to format partitions
mount - to mount formatted partitions to mountpoint( directory)
yum - to install software binaries
apt - to install software on debian
file - to set properties on files or directiories
synchronize - to copy files from local file system on control node to managed node.
lineinfile - to update line in a file
command (Default) - to run ad-hoc commands
unarchive - to get zip files remotely and then unarchive them to the target location
For the lab practice, you may destroy your VMs and re-create again.
- set up password less authentication
$ sudo vagratn destroy --force
Make sure you keep your important config files
$ sudo vagrant up --provider=libvert
VM is created.
Login to control node
$ ssh control-node
$ rm .ssh/know_hosts
Password less login
$ ssh-keygen
From control node
Run ansible command
Validate that you are able to run commands from control node
$ ansible all -i myhosts -m command -a "hostname -f"
Lets go ahead and try with parted module
first google for parted module
absible parted
go to through the docs and look at the example
$ ansible all \
-i myhosts \
-m parted \
-a "device=/dev/vdb number=1 state=present" \
--become
$ ansible all -i myhosts -m parted -a "device=/dev/vdc number=1 state=present" -b
you have to have root pw
This command will create a partition on each of the disk vdb and vdc
now we have to format. go back to google and look for ansible filesystem
to create filesystem, run the following command,
$ ansible all \
-i myhosts \
- m filesystem \
- a "fstype=ext4 dev=dev/vdb" \
--become
go and create filessytem on other device as well
$ ansible all -i myhosts -m filesystem -a "fstype=ext4 dev\/dev/vdc" --become
now, time to mount
google for "ansible mount"
look at the required ones.
path and state are required ones.
source
go to the example section
$ ansible all \
- i myhosts
- m mount \
-a "src=/dev/vdb state=mounted path=/data fstype=ext4
$ ansible all -i hosts -m mount -a "src=/dev/vdc state=mounted path=/data fstype=ext4 -become
check the fstab on the client machine.
if you get any errors, check the example @ansible documents.
Monday, March 15, 2021
RHEL Creating filesystem using ansible modules parted, filesystem, mount
Subscribe to:
Post Comments (Atom)
Git branch show detached HEAD
Git branch show detached HEAD 1. List your branch $ git branch * (HEAD detached at f219e03) 00 2. Run re-set hard $ git reset --hard 3. ...
-
snmpconfig command allow you to managge snmpv1/v3 agent configuration on SAN switch. Event trap level is mapped with event severity level....
-
Firmware upgrade on HPE SuperDom Flex 280 - prerequisites tasks a. Set up repo b. Upload firmware to your webserver 1. For foundation so...
-
Disabling the Telnet protocol on Brocade SAN switches By default, telnet is enabled on Brocade SAN switches. As part of security hardening o...
No comments:
Post a Comment