On 02/02/2022 19:50, Rene Paquin wrote:

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

Thanks,

********************************
Rene Paquin - Systems Administrator
Wilfrid Laurier University
Waterloo, Ontario
(519)884-0710 x3795
[email protected] <mailto:[email protected]>

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/YT2PR01MB6256445CD02F696E3D8F076CD8279%40YT2PR01MB6256.CANPRD01.PROD.OUTLOOK.COM
 
<https://groups.google.com/d/msgid/ansible-project/YT2PR01MB6256445CD02F696E3D8F076CD8279%40YT2PR01MB6256.CANPRD01.PROD.OUTLOOK.COM?utm_medium=email&utm_source=footer>.


--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration.

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/fd814503-424c-9be2-16ae-96c14fb30199%40linuxia.de.

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to