# multiple vm playbook

**URL:** <https://forum.ansible.com/t/multiple-vm-playbook/36281>\
**Category:** Ansible Project\
**Created:** [February 2, 2022, 6:50pm UTC](https://forum.ansible.com/t/multiple-vm-playbook/36281 "2022-02-02T18:50:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rene\_Paquin](https://avatars.discourse-cdn.com/v4/letter/r/e9a140/32.png) [@Rene\_Paquin](https://forum.ansible.com/u/Rene_Paquin)\
**Post date:** [February 2, 2022, 6:50pm UTC](https://forum.ansible.com/t/multiple-vm-playbook/36281/1 "2022-02-02T18:50:53Z")

</div>

I am attempting to create a playbook to deploy multiple linux VMs from a template and assigning a static ip and I am running into issues. My playbook:

---

<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:** [February 2, 2022, 6:56pm UTC](https://forum.ansible.com/t/multiple-vm-playbook/36281/2 "2022-02-02T18:56:51Z")

</div>

> I am attempting to create a playbook to deploy multiple linux VMs from a template and assigning a static ip and I am running into issues. My playbook:
> 
> ---
> 
> - hosts: localhost
> 
> gather\_facts: no
> 
> vars\_files:
> 
> ```
> \- group\_vars/vars
> 
> \- group\_vars/vars\_sec
> 
> ```
> 
> tasks:
> 
> - name: Clone the template
> 
> ```
> vmware\_guest:
> 
> hostname: &quot;\{\{ vcenter\_server \}\}&quot;
> 
> username: &quot;\{\{ vcenter\_user \}\}&quot;
> 
> password: &quot;\{\{ vcenter\_pass \}\}&quot;
> 
> validate\_certs: False
> 
> name: &quot;\{\{ item\.name \}\}&quot;
> 
> template: &quot;\{\{ template \}\}&quot;
> 
> datacenter: &quot;\{\{ datacenter\_name \}\}&quot;
> 
> folder: &quot;\{\{ folder \}\}&quot;
> 
> cluster: &quot;\{\{ cluster\_name \}\}&quot;
> 
> datastore: &quot;\{\{ datastore \}\}&quot;
> 
> networks:
> 
> name: &quot;\{\{ lan \}\}&quot;
> 
> ip: &#39;\{\{ item\.ip \}\}&#39;
> 
> netmask: 255\.255\.254\.0
> 
> gateway: &quot;\{\{ gw \}\}&quot;
> 
> connected: yes
> 
> start\_connected: yes
> 
> state: poweredon
> 
> wait\_for\_ip\_address: yes
> 
> delegate\_to: localhost
> 
> with\_items:
> 
> \- \{ name: qanstest01, ip: 10\.10\.73\.43 \}
> 
> \- \{ name: qanstest02, ip: 10\.10\.73\.44 \}
> 
> \- \{ name: qanstest03, ip: 10\.10\.73\.45 \}
> 
> ```
> 
> When I run the playbook I get the following error output
> 
> "msg": "argument 'networks' is of type \<class 'dict'\> and we were unable to convert to list: \<class 'dict'\> cannot be converted to a list"
> 
> Any suggestions on how to get around this?

Use a list for the network parameters as shown in the examples for this module:

networks:

```
 \- name: &quot;\{\{ lan \}\}&quot;

   ip: &#39;\{\{ item\.ip \}\}&#39;

   netmask: 255\.255\.254\.0

   gateway: &quot;\{\{ gw \}\}&quot;

   connected: yes

   start\_connected: yes

```

Regards

```
         Racke

```
