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:
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: "\{\{ vcenter\_server \}\}" username: "\{\{ vcenter\_user \}\}" password: "\{\{ vcenter\_pass \}\}" validate\_certs: False name: "\{\{ item\.name \}\}" template: "\{\{ template \}\}" datacenter: "\{\{ datacenter\_name \}\}" folder: "\{\{ folder \}\}" cluster: "\{\{ cluster\_name \}\}" datastore: "\{\{ datastore \}\}" networks: name: "\{\{ lan \}\}" ip: '\{\{ item\.ip \}\}' netmask: 255\.255\.254\.0 gateway: "\{\{ gw \}\}" 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: "\{\{ lan \}\}"
ip: '\{\{ item\.ip \}\}'
netmask: 255\.255\.254\.0
gateway: "\{\{ gw \}\}"
connected: yes
start\_connected: yes
Regards
Racke