# Problems with VMWARE and In-Memory Inventory

**URL:** <https://forum.ansible.com/t/problems-with-vmware-and-in-memory-inventory/25754>\
**Category:** Ansible Project\
**Tags:** vmware\
**Created:** [October 16, 2017, 8:33am UTC](https://forum.ansible.com/t/problems-with-vmware-and-in-memory-inventory/25754 "2017-10-16T08:33:56Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mariano\_Obarrio\_Mile](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@Mariano\_Obarrio\_Mile](https://forum.ansible.com/u/Mariano_Obarrio_Mile)\
**Post date:** [October 16, 2017, 8:33am UTC](https://forum.ansible.com/t/problems-with-vmware-and-in-memory-inventory/25754/1 "2017-10-16T08:33:56Z")

</div>

Hi all,  
I don’t know what I do wrong… I try create VMs (vmware) and provisioning after that. But when try add this new vms to inventory with add\_host only add one.

The task “Gather VM facts (vmware\_guest\_facts)” recover 2 IPs but then “Add Host to inventory” only add one IP to in-memory inventory.

I try multiples scenarios (with\_dict/set\_fact…) to add\_host to inventory but nothing work!

Any idias what I do wrong, any suggestions?

Thxs,

Mariano

`ansible 2.5.0 config file = /var/adm/ssoo/opt/ansible/ansible.cfg configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python2.7/site-packages/ansible-2.5.0-py2.7.egg/ansible executable location = /usr/bin/ansible python version = 2.7.5 (default, Aug 4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]`

**# cat /etc/ansible/hosts**

`  
[centos-vms]  
learn[05:06] disk=‘10’ datastore=‘LUN24\_VNX5600\_MIRROR’ network=‘dvPortGroupCentral’ memory=‘256’ cpucount=‘1’ osid=‘centos64Guest’ ansible\_ssh\_private\_key\_file=/root/.ssh/learning.pem ansible\_user=root ansible\_password=xxxxxxx learn[05:06].node.consul=learn[05:06]

`

`  
**#!/usr/bin/ansible-playbook**

---

<div class="post-metadata">

**Author:** ![Sebastien\_Desbois](https://avatars.discourse-cdn.com/v4/letter/s/3ab097/32.png) [@Sebastien\_Desbois](https://forum.ansible.com/u/Sebastien_Desbois)\
**Post date:** [October 16, 2017, 3:03pm UTC](https://forum.ansible.com/t/problems-with-vmware-and-in-memory-inventory/25754/2 "2017-10-16T15:03:53Z")

</div>

Hello,

The probleme seems that Ansible do not that it needs to loop on the add\_host part, since there is no parameter like {{ inventory\_hostname }} to indicate it needs to loop on it.

Maybe if you try to add a false variable set to the inventory\_hostname, it could help it to loop ?  
Should look like this :

- name: Add Host to inventory  
add\_host:  
hostname: “{{ vm\_facts.ansible\_facts.hw\_eth0.ipaddresses[0] }}”  
groups: in-memory-vms  
ansible\_ssh\_host: “{{ vm\_facts.ansible\_facts.hw\_eth0.ipaddresses[0] }}”  
ansible\_user: root  
ansible\_password: xxxxxxxxx  
ansible\_distribution: “CentOS”  
ansible\_system: “Linux”  
foo: {{ inventory\_hostname }}

---

<div class="post-metadata">

**Author:** ![Mariano\_Obarrio\_Mile](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@Mariano\_Obarrio\_Mile](https://forum.ansible.com/u/Mariano_Obarrio_Mile)\
**Post date:** [October 17, 2017, 11:25am UTC](https://forum.ansible.com/t/problems-with-vmware-and-in-memory-inventory/25754/3 "2017-10-17T11:25:53Z")

</div>

Hi Sebastien,  
I try with a loop but the result it’s the same. Only add one of both. Learn05 (.232.141)

The loop:

`

- name: DEBUG Show inventory\_hostname  
debug: msg=“inventory\_hostname {{inventory\_hostname}}”

- name: Add\_host with Loop  
add\_host:  
name: “{{item.value.ipv4}}”  
groups: in-memory-vms  
ansible\_ssh\_host: “{{item.value.ipv4}}”  
ansible\_distribution: “CentOS”  
ansible\_system: “Linux”  
ansible\_ssh\_private\_key\_file: /root/.ssh/ansible.pem  
with\_dict: “{{ instance\_facts }}”  
when: item.key in [‘instance’]  
changed\_when: false

`

When execute the new playbook, only added learn05, but the debug in “TASK [vmware : DEBUG Show inventory\_hostname]” show two hosts.

In the common role I added a debug line “TASK [common : debug]” to show all groups outside of vmware role. If you can see the in-memory-vms group have only one IP learn05 (.232.141)

**[root@learn01 ansible]# ./createvm.yml**

`  
PLAY [centos-vms] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [vmware : include\_tasks] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
included: /var/adm/ssoo/opt/ansible/roles/vmware/tasks/create\_vms\_from\_template.yml for learn05, learn06

TASK [vmware : Create VM from Template] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
changed: [learn06 → localhost]  
changed: [learn05 → localhost]

TASK [vmware : Espera asignacion de IP via DHCP] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
Pausing for 60 seconds  
(ctrl+C then ‘C’ = continue early, ctrl+C then ‘A’ = abort)  
ok: [learn05]

TASK [vmware : Gather instance facts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [learn06]  
ok: [learn05]

TASK [vmware : DEBUG Show inventory\_hostname] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [learn05] =\> {  
“msg”: “inventory\_hostname learn05”  
}  
ok: [learn06] =\> {  
“msg”: “inventory\_hostname learn06”  
}

TASK [vmware : Add\_host with Loop] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [learn05] =\> (item={‘key’: u’instance’, ‘value’: {u’hw\_name’: u’learn05’, u’hw\_power\_status’: u’poweredOn’, u’hw\_processor\_count’: 1, u’hw\_memtotal\_mb’: 256, u’module\_hw’: True, u’snapshots’: , u’customvalues’: {}, u’hw\_guest\_full\_name’: u’CentOS 4/5/6/7 (64-bit)‘, u’hw\_interfaces’: [u’eth0’], u’hw\_guest\_id’: u’centos64Guest’, u’current\_snapshot’: None, u’ipv6’: None, u’guest\_tools\_version’: u’10249’, u’hw\_eth0’: {u’macaddress’: u’00:50:56:81:16:fe’, u’addresstype’: u’assigned’, u’macaddress\_dash’: u’00-50-56-81-16-fe’, u’label’: u’Network adapter 1’, u’ipaddresses’: [u’50.0.232.141’], u’summary’: u’DVSwitch: 79 24 01 50 c4 9c af f0-ce 89 4a 9a 00 1a d2 e8’}, u’hw\_product\_uuid’: u’4201f0a4-fa12-f243-a715-227d401193bf’, u’annotation’: u’‘, u’guest\_tools\_status’: u’guestToolsRunning’, u’ipv4’: u’50.0.232.141’}})  
skipping: [learn05] =\> (item={‘key’: ‘attempts’, ‘value’: 1})  
skipping: [learn05] =\> (item={‘key’: ‘changed’, ‘value’: False})  
skipping: [learn05] =\> (item={‘key’: u’failed’, ‘value’: False})

PLAY [in-memory-vms] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [common : debug] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [50.0.232.141] =\> {  
“groups”: {  
“all”: [  
“learn05”,  
“learn06”,  
“taurus”,  
“learn01”,  
“learn02”,  
“learn03”,  
“learn04”,  
“50.0.232.141”  
],  
“centos-vms”: [  
“learn05”,  
“learn06”  
],  
“in-memory-vms”: [  
“50.0.232.141”  
],  
“solaris”: [  
“taurus”  
],  
“ungrouped”:   
}  
}

…  
…  
…

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
50.0.232.141 : ok=14 changed=0 unreachable=0 failed=0  
learn05 : ok=6 changed=1 unreachable=0 failed=0  
learn06 : ok=4 changed=1 unreachable=0 failed=0

`

---

<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:** [October 17, 2017, 12:07pm UTC](https://forum.ansible.com/t/problems-with-vmware-and-in-memory-inventory/25754/4 "2017-10-17T12:07:37Z")

</div>

Hi,

Ansible 2.5 is not stable as of now… I would recommend to use 2.3.x or 2.4.y version to use in production…  
Anyway this is not the problem here.  
As written in documentation, add\_host broke loop\_play (in note section : This module bypasses the play host loop and only runs once for all the hosts in the play, if you need it to iterate use a with\_ directive). So it works as defined

Regards,

JYL

16 octobre 2017 10:35 “Mariano Obarrio Miles” \<mariano.obarrio@gmail.com\> a écrit:

---

<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:** [October 17, 2017, 12:11pm UTC](https://forum.ansible.com/t/problems-with-vmware-and-in-memory-inventory/25754/5 "2017-10-17T12:11:59Z")

</div>

Hi,

There’s a loop indeed, but I thinks there’s something wrong in your variable because it is looping with  
first iteration item.key ==\> 'instance"  
second iteration item.key ==\> ‘attempts’  
third\_iteration item.key ==\> ‘changed’,  
fourth iteration item.key ==\> ‘failed’

So it’s more a bug in your variable you are using than the loop itself which the problem lies…

Regards,

JYL

17 octobre 2017 13:27 “Mariano Obarrio Miles” \<mariano.obarrio@gmail.com\> a écrit:

---

<div class="post-metadata">

**Author:** ![Sebastien\_Desbois](https://avatars.discourse-cdn.com/v4/letter/s/3ab097/32.png) [@Sebastien\_Desbois](https://forum.ansible.com/u/Sebastien_Desbois)\
**Post date:** [October 17, 2017, 12:57pm UTC](https://forum.ansible.com/t/problems-with-vmware-and-in-memory-inventory/25754/6 "2017-10-17T12:57:28Z")

</div>

Hello,

For my part, I’m using the way described by JYL.

`

- include\_role:  
name: myrolewhoaddsininventory  
with\_items: “{{ mylist }}”  
`

the add\_host task is included amonfg other things in the role.  
And at the end, I get the in-memory inventory properly filed.

---

<div class="post-metadata">

**Author:** ![Mariano\_Obarrio\_Mile](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@Mariano\_Obarrio\_Mile](https://forum.ansible.com/u/Mariano_Obarrio_Mile)\
**Post date:** [October 17, 2017, 1:00pm UTC](https://forum.ansible.com/t/problems-with-vmware-and-in-memory-inventory/25754/7 "2017-10-17T13:00:37Z")

</div>

Hi Jean,

About this:

There’s a loop indeed, but I thinks there’s something wrong in your variable because it is looping with  
first iteration item.key ==\> 'instance"  
second iteration item.key ==\> ‘attempts’  
third\_iteration item.key ==\> ‘changed’,  
fourth iteration item.key ==\> ‘failed’

In the loop I use “**when: item.key in [‘instance’]**” because the facts have others keys I need ignore.

`ASK [vmware : Add_host with Loop] ****************************************************************************************************************************************************************************************************** ok: [learn05] => (item={'key': u'instance', 'value': {u'hw_name': u'learn05', u'hw_power_status': u'poweredOn', u'hw_processor_count': 1, u'hw_memtotal_mb': 256, u'module_hw': True, u'snapshots': [], u'customvalues': {}, u'hw_guest_full_name': u'CentOS 4/5/6/7 (64-bit)', u'hw_interfaces': [u'eth0'], u'hw_guest_id': u'centos64Guest', u'current_snapshot': None, u'ipv6': None, u'guest_tools_version': u'10249', u'hw_eth0': {u'macaddress': u'00:50:XX:81:XX:XX', u'addresstype': u'assigned', u'macaddress_dash': u'00-XX-XX-XX-XX-XX', u'label': u'Network adapter 1', u'ipaddresses': [u'50.0.232.141'], u'summary': u'DVSwitch: 79 24 01 50 c4 9c af f0-ce 89 4a 9a 00 1a d2 e8'}, u'hw_product_uuid': u'4201f0a4-fa12-f243-a715-227d401193bf', u'annotation': u'', u'guest_tools_status': u'guestToolsRunning', u'ipv4': u'50.0.232.141'}}) skipping: [learn05] => (item={'key': 'attempts', 'value': 1}) skipping: [learn05] => (item={'key': 'changed', 'value': False}) skipping: [learn05] => (item={'key': u'failed', 'value': False})`

`  
ok: [learn05] =\> {  
“instance\_facts”: {  
“attempts”: 1,  
“changed”: false,  
“failed”: false,  
“instance”: {  
“annotation”: “”,  
“current\_snapshot”: null,  
“customvalues”: {},  
“guest\_tools\_status”: “guestToolsRunning”,  
“guest\_tools\_version”: “10249”,  
“hw\_eth0”: {  
“addresstype”: “assigned”,  
“ipaddresses”: [  
“50.0.232.152”  
],  
“label”: “Network adapter 1”,  
“macaddress”: “00:X0:5X:81:60:Xa”,  
“macaddress\_dash”: “00-X0-5X-81-60-Xa”,  
“summary”: “DVSwitch: 79 24 01 50 c4 9c af f0-ce 89 4a 9a 00 1a d2 e8”  
},  
“hw\_guest\_full\_name”: “CentOS 4/5/6/7 (64-bit)”,  
“hw\_guest\_id”: “centos64Guest”,  
“hw\_interfaces”: [  
“eth0”  
],  
“hw\_memtotal\_mb”: 256,  
“hw\_name”: “learn05”,  
“hw\_power\_status”: “poweredOn”,  
“hw\_processor\_count”: 1,  
“hw\_product\_uuid”: “4201c0c8-179f-8f8b-eb84-ad1684f493bf”,  
“ipv4”: “50.0.232.152”,  
“ipv6”: null,  
“module\_hw”: true,  
“snapshots”:   
}  
}  
}

`

About now, I downgrade ansible to 2.4 and remove the loop but the behaviour it’s the same.

**[root@learn01 ansible]# ansible --version**  
`ansible 2.4.0.0 config file = /etc/ansible/ansible.cfg configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python2.7/site-packages/ansible executable location = /usr/bin/ansible python version = 2.7.5 (default, Aug 4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]`

`

---

<div class="post-metadata">

**Author:** ![Mariano\_Obarrio\_Mile](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@Mariano\_Obarrio\_Mile](https://forum.ansible.com/u/Mariano_Obarrio_Mile)\
**Post date:** [October 17, 2017, 1:22pm UTC](https://forum.ansible.com/t/problems-with-vmware-and-in-memory-inventory/25754/8 "2017-10-17T13:22:17Z")

</div>

Hi Sebastien,  
You have a role to create VMs and other to add\_host to inventory? I try it and send you a feedback soon.

Thxs!

M.

---

<div class="post-metadata">

**Author:** ![Sebastien\_Desbois](https://avatars.discourse-cdn.com/v4/letter/s/3ab097/32.png) [@Sebastien\_Desbois](https://forum.ansible.com/u/Sebastien_Desbois)\
**Post date:** [October 17, 2017, 4:54pm UTC](https://forum.ansible.com/t/problems-with-vmware-and-in-memory-inventory/25754/9 "2017-10-17T16:54:07Z")

</div>

Hello

I use the same role to create the VM and add\_host.  
This way, with the first item, it creates the VM and add it to the in-memory inventory.  
Then it loops and do the same with the second item.  
Etc…  
Unless you destroy your in-memory inventory at some point, it will be available and used through all the play.

Best Regards,

---

<div class="post-metadata">

**Author:** ![Mariano\_Obarrio\_Mile](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@Mariano\_Obarrio\_Mile](https://forum.ansible.com/u/Mariano_Obarrio_Mile)\
**Post date:** [October 18, 2017, 10:19am UTC](https://forum.ansible.com/t/problems-with-vmware-and-in-memory-inventory/25754/10 "2017-10-18T10:19:45Z")

</div>

Ok now all work fine, I make some mistakes!!!

Downgrade to stable Ansible version just like suggested Jean solved different issues like “wait\_for\_ip\_address: true” in ansible 2.4 work but in 2.5 not.

Now I don’t use in-memory inventory, I solve it setting ansible\_ssh\_host, because the server exist in the inventory and I don’t need duplicate it.

`  
#!/usr/bin/ansible-playbook
