# Check status of VMware tools & reboot if VMware tools are not running

**URL:** <https://forum.ansible.com/t/check-status-of-vmware-tools-reboot-if-vmware-tools-are-not-running/32709>\
**Category:** Ansible Project\
**Tags:** vmware\
**Created:** [April 17, 2020, 7:30am UTC](https://forum.ansible.com/t/check-status-of-vmware-tools-reboot-if-vmware-tools-are-not-running/32709 "2020-04-17T07:30:38Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kiran\_Kumar](https://avatars.discourse-cdn.com/v4/letter/k/f475e1/32.png) [@Kiran\_Kumar](https://forum.ansible.com/u/Kiran_Kumar)\
**Post date:** [April 17, 2020, 7:30am UTC](https://forum.ansible.com/t/check-status-of-vmware-tools-reboot-if-vmware-tools-are-not-running/32709/1 "2020-04-17T07:30:38Z")

</div>

Hi

I need to check status of VMware tools on vms & if VMware tools are not running, then reboot the vm. I have below playbook which works fine to find vm name & VMware tools status. Please help on how can i extract the vm name & take action as per status.

Note : i have to use the VMware modules as the OS typically will be in hung status ( hence tools not running ) , hence avoid user OS level task ( and use VMware task )

Thanks

---

<div class="post-metadata">

**Author:** ![Akasurde](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/akasurde/32/230_2.png) [@Akasurde](https://forum.ansible.com/u/Akasurde)\
**Post date:** [April 17, 2020, 8:26am UTC](https://forum.ansible.com/t/check-status-of-vmware-tools-reboot-if-vmware-tools-are-not-running/32709/2 "2020-04-17T08:26:21Z")

</div>



---

<div class="post-metadata">

**Author:** ![Tony\_Wong](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@Tony\_Wong](https://forum.ansible.com/u/Tony_Wong)\
**Post date:** [April 18, 2020, 6:22pm UTC](https://forum.ansible.com/t/check-status-of-vmware-tools-reboot-if-vmware-tools-are-not-running/32709/3 "2020-04-18T18:22:29Z")

</div>

Hi

why is it when i run this playbook I get this error

tony@ubuntu:~/ansiblework$ ansible-playbook vmware\_tools.yml  
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match ‘all’

ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.

The error appears to be in ‘/home/tony/ansiblework/vmware\_tools.yml’: line 9, column 5, but may  
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

tasks:

- name: Get information about the virtual machine  
^ here

---

<div class="post-metadata">

**Author:** ![Jorge\_Rua1](https://avatars.discourse-cdn.com/v4/letter/j/a87d85/32.png) [@Jorge\_Rua1](https://forum.ansible.com/u/Jorge_Rua1)\
**Post date:** [April 18, 2020, 6:58pm UTC](https://forum.ansible.com/t/check-status-of-vmware-tools-reboot-if-vmware-tools-are-not-running/32709/4 "2020-04-18T18:58:09Z")

</div>

That error message often indicates an indentation issue or a missing module parameter.

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [April 18, 2020, 8:11pm UTC](https://forum.ansible.com/t/check-status-of-vmware-tools-reboot-if-vmware-tools-are-not-running/32709/5 "2020-04-18T20:11:13Z")

</div>

That module was introduced in ansible 2.5:  
[https://docs.ansible.com/ansible/latest/modules/vmware\_guest\_powerstate\_module.html](https://docs.ansible.com/ansible/latest/modules/vmware_guest_powerstate_module.html)

Do you run an older version?

---

<div class="post-metadata">

**Author:** ![Tony\_Wong](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@Tony\_Wong](https://forum.ansible.com/u/Tony_Wong)\
**Post date:** [April 18, 2020, 8:14pm UTC](https://forum.ansible.com/t/check-status-of-vmware-tools-reboot-if-vmware-tools-are-not-running/32709/6 "2020-04-18T20:14:54Z")

</div>

this is the playbook

---

<div class="post-metadata">

**Author:** ![jean-yves](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jean-yves](https://forum.ansible.com/u/jean-yves)\
**Post date:** [April 18, 2020, 8:19pm UTC](https://forum.ansible.com/t/check-status-of-vmware-tools-reboot-if-vmware-tools-are-not-running/32709/7 "2020-04-18T20:19:50Z")

</div>

Please as said by another people here, respect indentations stricly !

vmware\_guest\_info & name have not the same indentation as written by A. Kasurde

Regards,

JYL

---

<div class="post-metadata">

**Author:** ![David\_Foley](https://avatars.discourse-cdn.com/v4/letter/d/9e8a1a/32.png) [@David\_Foley](https://forum.ansible.com/u/David_Foley)\
**Post date:** [April 18, 2020, 8:26pm UTC](https://forum.ansible.com/t/check-status-of-vmware-tools-reboot-if-vmware-tools-are-not-running/32709/8 "2020-04-18T20:26:06Z")

</div>



---

<div class="post-metadata">

**Author:** ![Tony\_Wong](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@Tony\_Wong](https://forum.ansible.com/u/Tony_Wong)\
**Post date:** [April 18, 2020, 8:42pm UTC](https://forum.ansible.com/t/check-status-of-vmware-tools-reboot-if-vmware-tools-are-not-running/32709/9 "2020-04-18T20:42:31Z")

</div>

what editor can i use on my ubuntu box? I cant use anything other than vim.

still getting the error.

tony@ubuntu:~/ansiblework$ ansible-playbook info.yml  
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match ‘all’

ERROR! Syntax Error while loading YAML.  
mapping values are not allowed in this context

The error appears to be in ‘/home/tony/ansiblework/info.yml’: line 3, column 8, but may  
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

name: get info vm  
hosts: localhost  
^ here

---

<div class="post-metadata">

**Author:** ![Tony\_Wong](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@Tony\_Wong](https://forum.ansible.com/u/Tony_Wong)\
**Post date:** [April 18, 2020, 8:45pm UTC](https://forum.ansible.com/t/check-status-of-vmware-tools-reboot-if-vmware-tools-are-not-running/32709/10 "2020-04-18T20:45:45Z")

</div>

> **(attachments)**
>
> ![Screen Shot 2020-04-18 at 1.45.30 PM.png](https://us1.discourse-cdn.com/ansible/original/2X/b/b5069df22986ee9d9d2f75dd73812f68e5fc1548.png)

---

<div class="post-metadata">

**Author:** ![David\_Foley](https://avatars.discourse-cdn.com/v4/letter/d/9e8a1a/32.png) [@David\_Foley](https://forum.ansible.com/u/David_Foley)\
**Post date:** [April 18, 2020, 8:53pm UTC](https://forum.ansible.com/t/check-status-of-vmware-tools-reboot-if-vmware-tools-are-not-running/32709/11 "2020-04-18T20:53:47Z")

</div>

you missing **" - "**

---

<div class="post-metadata">

**Author:** ![David\_Foley](https://avatars.discourse-cdn.com/v4/letter/d/9e8a1a/32.png) [@David\_Foley](https://forum.ansible.com/u/David_Foley)\
**Post date:** [April 18, 2020, 8:55pm UTC](https://forum.ansible.com/t/check-status-of-vmware-tools-reboot-if-vmware-tools-are-not-running/32709/12 "2020-04-18T20:55:19Z")

</div>

Why Aren’t you using your Local Machine using Atom or VS Code to build your Yaml files then using WinSCP copy the playbooks over ?

---

<div class="post-metadata">

**Author:** ![Tony\_Wong](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@Tony\_Wong](https://forum.ansible.com/u/Tony_Wong)\
**Post date:** [April 18, 2020, 9:25pm UTC](https://forum.ansible.com/t/check-status-of-vmware-tools-reboot-if-vmware-tools-are-not-running/32709/13 "2020-04-18T21:25:42Z")

</div>

this is what i have. but still not working

> **(attachments)**
>
> ![Screen Shot 2020-04-18 at 2.25.17 PM.png](https://us1.discourse-cdn.com/ansible/original/2X/2/268b9efea777e2b72ea92e5dea5ecb23ba422be7.png)

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [April 18, 2020, 9:57pm UTC](https://forum.ansible.com/t/check-status-of-vmware-tools-reboot-if-vmware-tools-are-not-running/32709/14 "2020-04-18T21:57:01Z")

</div>

What does ‘ansible --version’ say?

---

<div class="post-metadata">

**Author:** ![Kiran\_Kumar](https://avatars.discourse-cdn.com/v4/letter/k/f475e1/32.png) [@Kiran\_Kumar](https://forum.ansible.com/u/Kiran_Kumar)\
**Post date:** [April 19, 2020, 6:29am UTC](https://forum.ansible.com/t/check-status-of-vmware-tools-reboot-if-vmware-tools-are-not-running/32709/15 "2020-04-19T06:29:09Z")

</div>

Thanks Abhijeet !

---

<div class="post-metadata">

**Author:** ![Kiran\_Kumar](https://avatars.discourse-cdn.com/v4/letter/k/f475e1/32.png) [@Kiran\_Kumar](https://forum.ansible.com/u/Kiran_Kumar)\
**Post date:** [April 19, 2020, 6:32am UTC](https://forum.ansible.com/t/check-status-of-vmware-tools-reboot-if-vmware-tools-are-not-running/32709/16 "2020-04-19T06:32:03Z")

</div>

Use [https://onlineyamltools.com/validate-yaml](https://onlineyamltools.com/validate-yaml)

This will help you validate the syntax

---

<div class="post-metadata">

**Author:** ![Tony\_Wong](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@Tony\_Wong](https://forum.ansible.com/u/Tony_Wong)\
**Post date:** [April 19, 2020, 3:38pm UTC](https://forum.ansible.com/t/check-status-of-vmware-tools-reboot-if-vmware-tools-are-not-running/32709/17 "2020-04-19T15:38:46Z")

</div>

tony@ubuntu:~/ansiblework$ ansible --version  
ansible 2.8.2  
config file = /home/tony/ansiblework/ansible.cfg  
configured module search path = [u’/home/tony/ansiblework/library’]  
ansible python module location = /usr/lib/python2.7/dist-packages/ansible  
executable location = /usr/bin/ansible  
python version = 2.7.16 (default, Apr 9 2019, 04:50:39) [GCC 8.3.0]

---

<div class="post-metadata">

**Author:** ![Tony\_Wong](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@Tony\_Wong](https://forum.ansible.com/u/Tony_Wong)\
**Post date:** [April 19, 2020, 7:13pm UTC](https://forum.ansible.com/t/check-status-of-vmware-tools-reboot-if-vmware-tools-are-not-running/32709/18 "2020-04-19T19:13:26Z")

</div>

![Screen Shot 2020-04-19 at 12.10.46 PM.png](https://us1.discourse-cdn.com/ansible/original/2X/7/774db3cbf01b6f45234d342ee28cdc03b48124dc.png)

tony@ubuntu:~/ansiblework$ ansible-playbook vmware\_tools.yml  
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match ‘all’

ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.

The error appears to be in ‘/home/tony/ansiblework/vmware\_tools.yml’: line 7, column 5, but may  
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

tasks:

- name: get info about the virtual machine  
^ here

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [April 19, 2020, 7:47pm UTC](https://forum.ansible.com/t/check-status-of-vmware-tools-reboot-if-vmware-tools-are-not-running/32709/19 "2020-04-19T19:47:35Z")

</div>

> Screen Shot 2020-04-19 at 12.10.46 PM.png
> 
> tony@ubuntu:~/ansiblework$ ansible-playbook vmware\_tools.yml  
> [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
> 
> ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.
> 
> The error appears to be in '/home/tony/ansiblework/vmware\_tools.yml': line 7, column 5, but may  
> be elsewhere in the file depending on the exact syntax problem.
> 
> The offending line appears to be:
> 
> tasks:  
> - name: get info about the virtual machine  
> ^ here

The task need to be indented:

&nbsp;&nbsp;&nbsp;&nbsp;tasks:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- name: get info about the virtual machine

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke

---

<div class="post-metadata">

**Author:** ![Tony\_Wong](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@Tony\_Wong](https://forum.ansible.com/u/Tony_Wong)\
**Post date:** [April 19, 2020, 8:50pm UTC](https://forum.ansible.com/t/check-status-of-vmware-tools-reboot-if-vmware-tools-are-not-running/32709/20 "2020-04-19T20:50:35Z")

</div>

it is already indented

[Next page](https://forum.ansible.com/t/check-status-of-vmware-tools-reboot-if-vmware-tools-are-not-running/32709.md?page=2)
