Get VMWare Hypervisor Maintenance Mode state

I want to check if a VMWare Hypervisor (ESXi Host) is in Maintenance Mode or not. I’ve been through the docs for the various vmware_* modules but I can’t see any which will return this value. Have I missed it or isn’t this possible with Ansible?

How about utilising vmware_maintenancemode’s state parameter?

https://docs.ansible.com/ansible/latest/modules/vmware_maintenancemode_module.html#vmware-maintenancemode-module

Regards

Phil

Looked at this - it seems that is only puts a host in to maintenance mode - I don’t think it will query the current state without making changes

True, but you could use Check Mode (–check) to do a “dry-run” without actually making any changes though. Can’t help thinking there’s probably a better option, like you, but haven’t got time to look tbh.

Regards

Phil