Mark,

Something like this:

---
 - hosts: 127.0.0.1
   connection: local
   user: root
   sudo: false
   gather_facts: false
   serial: 1
   vars:
     vcenter_hostname: UK.server.local
     esxhost: xxx.xxx.xxx.xxx
     datastore: UK1
     network: Web
     vmcluster: UKCLUSTER
     folder: Utilities
     notes: Created by Ansible

   tasks:
    - name: pick up hostnames to create
      include_vars: hostnames.yml    
   
    - name: Create VM from template
      vsphere_guest:
        vcenter_hostname: "{{ vcenter_hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        guest: "{{ list }}"
        vm_extra_config:
          notes: "{{ notes }}"
          folder: "{{ folder }}"
        from_template: yes
        template_src: "{{ vmtemplate }}"
        cluster: "{{ vmcluster  }}"
        resource_pool: "/Resources"    
        esxi:
          datacenter: UK
          hostname: "{{ esxhost }}"
       with_items: serverlist
          

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/67dba27c-45fd-4889-a999-9000a8d39ca3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to