Ansible facts suggestion - more disk info (serial & more)

807 views
Skip to first unread message

edroz...@gmail.com

unread,
Nov 16, 2014, 6:16:10 PM11/16/14
to ansibl...@googlegroups.com
Hello,

It would be great to see some additional fields for disk devices coming back as Ansible facts. 

In particular, disk serial number would be very useful for scripting partitioning and raid setup of
disks based on drive serial (reliable) rather than based on disk letter (such as sda) which is
subject to the random drive letter re-ordering that many sas controllers do.

Other facts that could be useful:
* Firmware Version - to help find drives, esp. SSD's, that need firmware updates
* Both logical and physical sector sizes (may help in partitioning/raid/file system creation)
* LU WWN Device Id (not sure what it's used for actually)


For reference, info from smartctl -a :

=== START OF INFORMATION SECTION ===
Device Model:     ST240FP0021
Serial Number:    Z5800FZA
LU WWN Device Id: 5 000c50 02ff17e7b
Firmware Version: B690
User Capacity:    240,057,409,536 bytes [240 GB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   8
ATA Standard is:  ATA-8-ACS revision 4
Local Time is:    Sun Nov 16 15:08:13 2014 PST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

==================================================================


For reference, a typical fact block (Ansible 1.7.2) for a disk looks like the following:

"sda": {
                "holders": [],
                "host": "RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS 2208 [Thunderbolt] (rev 05)",
                "model": "ST240FP0021",
                "partitions": {
                    "sda1": {
                        "sectors": "467631247",
                        "sectorsize": 512,
                        "size": "222.98 GB",
                        "start": "2048"
                    }
                },
                "removable": "0",
                "rotational": "0",
                "scheduler_mode": "cfq",
                "sectors": "468862128",
                "sectorsize": "4096",
                "size": "1.75 TB",
                "support_discard": "0",
                "vendor": "ATA"
            },


Regards,
--Ed

Jonathan Mainguy

unread,
Nov 16, 2014, 6:44:00 PM11/16/14
to edroz...@gmail.com, ansibl...@googlegroups.com
Hey Ed,

Turns out John Stanton and you think alike. Here is his Pull Request adding serial numbers.


I am optimistic that this will get pulled.

Thank you,
Jon

--
You received this message because you are subscribed to the Google Groups "Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-deve...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

edroz...@gmail.com

unread,
Nov 17, 2014, 11:27:16 AM11/17/14
to ansibl...@googlegroups.com
After some more digging the LU WWN Device Id would be good to have also because some drives
apparently do have it printed on the label and therefore it would be useful for id'ing drives as well:


"We can see each drive listed multiple times because they can be referred to multiple ways: by their wwn ID, by their model and serial number as connected to the ATA bus, or by their model and serial number as connected to the (virtual, in this case) SCSI bus. Which one should you pick? Well, any of them will work, including the super simple devicename (like /dev/sdb) itself, but you want to pick one that you can also see on the label on the physical drive. This is so you can be absolutely certain that you pull and replace the correct drive later, if one fails.

If your drive doesn't show the wwn ID on the drive label, use the scsi-model-serial listing. If your drive does have the wwn ID printed visibly, I'd use that instead (just because it's shorter). In this example, my drives do have the wwn printed visibly, so I'm going to use that."

Michael DeHaan

unread,
Nov 17, 2014, 3:31:37 PM11/17/14
to edroz...@gmail.com, ansibl...@googlegroups.com
Yeah it's about time we start making facts stuff a bit more structured, and there's also a balance to be made between facts returning quickly, or gathering everything.

It may make a good module to have seperately from the core - possibly a "disk_facts" type module (maybe in Galaxy), I don't know.

But that's a line we need to walk.




--
Reply all
Reply to author
Forward
0 new messages