Hello,
I have a playbook that scans for hard drives and mounts them in order to do a backup of the data from those drives. I am able to scan for the drives just fine and I can also mount them (thanks to the Ansible IRC community). The only issue I am having is mounting ONLY when the partition is fstype: ntfs. As you can see below, when I run the parted module, I can see a key value of fstype: ntfs.
`
ok: [localhost] => (item=sda) => {
“changed”: false,
“disk”: {
“dev”: “/dev/sda”,
“logical_block”: 512,
“model”: “VMware Virtual disk”,
“physical_block”: 512,
“size”: 33554432.0,
“table”: “msdos”,
“unit”: “kib”
},
“invocation”: {
“module_args”: {
“align”: “optimal”,
“device”: “/dev/sda”,
“flags”: null,
“label”: null,
“name”: null,
“number”: null,
“part_end”: “100%”,
“part_start”: “0%”,
“part_type”: “primary”,
“state”: “info”,
“unit”: “KiB”
}
},
“item”: “sda”,
“partitions”: [
{
“begin”: 1024.0,
“end”: 308224.0,
“flags”: [
“boot”
],
“fstype”: “ntfs”,
“num”: 1,
“size”: 307200.0,
“unit”: “kib”
},
{
“begin”: 308224.0,
“end”: 33553408.0,
“flags”: ,
“fstype”: “ntfs”,
“num”: 2,
“size”: 33245184.0,
“unit”: “kib”
}
],
“script”: “unit ‘KiB’ print”
}
`
I use the setup module to scan for the devices and the parted module to see the fstype. Thinking about it further, I should probably just use the parted module to get me both since parted does provide both.
Using parted alone without setup, how can I tell my mount task to just mount ONLY if the fstype is ntfs? Here is my current playbook:
`