# Get VMWare Hypervisor Maintenance Mode state

**URL:** <https://forum.ansible.com/t/get-vmware-hypervisor-maintenance-mode-state/30881>\
**Category:** Ansible Project\
**Tags:** vmware\
**Created:** [July 26, 2019, 1:38pm UTC](https://forum.ansible.com/t/get-vmware-hypervisor-maintenance-mode-state/30881 "2019-07-26T13:38:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MKPhil](https://avatars.discourse-cdn.com/v4/letter/m/9e8a1a/32.png) [@MKPhil](https://forum.ansible.com/u/MKPhil)\
**Post date:** [July 26, 2019, 1:38pm UTC](https://forum.ansible.com/t/get-vmware-hypervisor-maintenance-mode-state/30881/1 "2019-07-26T13:38:28Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![P.Cookson](https://avatars.discourse-cdn.com/v4/letter/p/a6a055/32.png) [@P.Cookson](https://forum.ansible.com/u/P.Cookson)\
**Post date:** [July 26, 2019, 2:19pm UTC](https://forum.ansible.com/t/get-vmware-hypervisor-maintenance-mode-state/30881/2 "2019-07-26T14:19:07Z")

</div>

How about utilising vmware\_maintenancemode’s state parameter?

[https://docs.ansible.com/ansible/latest/modules/vmware\_maintenancemode\_module.html#vmware-maintenancemode-module](https://docs.ansible.com/ansible/latest/modules/vmware_maintenancemode_module.html#vmware-maintenancemode-module)

Regards

Phil

---

<div class="post-metadata">

**Author:** ![MKPhil](https://avatars.discourse-cdn.com/v4/letter/m/9e8a1a/32.png) [@MKPhil](https://forum.ansible.com/u/MKPhil)\
**Post date:** [July 26, 2019, 3:40pm UTC](https://forum.ansible.com/t/get-vmware-hypervisor-maintenance-mode-state/30881/3 "2019-07-26T15:40:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![P.Cookson](https://avatars.discourse-cdn.com/v4/letter/p/a6a055/32.png) [@P.Cookson](https://forum.ansible.com/u/P.Cookson)\
**Post date:** [July 29, 2019, 7:40am UTC](https://forum.ansible.com/t/get-vmware-hypervisor-maintenance-mode-state/30881/4 "2019-07-29T07:40:05Z")

</div>

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
