anonymus
(anonymus)
October 6, 2020, 5:35pm
1
i am newbie on ansible
i wanted to do the below task using ansible , is there any playbook for
Discovering an iscsi target
Login in
rescanning iscsi bus
formatting the newly discovered lun
creating filesystem on it.
updating /etc/fstab with newly mounted
Hi,
I did this in the past for block storage, guessing something similar to this example, I’ve not formatted the devices as this was for mounting a clone
tasks:
Rescan storage layer to pull in new devices to host
Example here is for emulex hba
name: Rescan HBA
command: /usr/bin/rescan-scsi-bus.sh
name: unmount filesystems by label
mount:
path: “{{ item }}”
state: unmounted
with_items:
/database
/reports
/logs
name: Create Directory
file:
path: “{{ item }}”
state: directory
with_items:
/database
/reports
/logs
name: Mount filesystems by label
mount:
path: “{{ item.mountpoint }}”
src: LABEL=“{{ item.label }}”
fstype: ext4
state: mounted
with_items:
{ label: ‘database’, mountpoint: ‘/database’}
{ label: ‘reports’, mountpoint: ‘/reports’}
{ label: ‘logs’, mountpoint: ‘/logs’}
Hello,
I have created below playbook, but i have not tested on live
check if its work for you.