Hi I am setting up a new VMware virtual machine from a template using a Ansible playbook.
I want to be able to change the datastore and the network (vm_disk and vm_nic) of the VM during the setup of the VM. But when I add this information into the playbook (see below), nothing happens. The new VM is created, but the datastore and network have not been adjust to what I requested in the playbook. They have remained the same as what the template image is. Am I doing something incorrect in the playbook? Or is this not possible with Ansible? Playbook (highlighted in bold is what is not being adjusted) --- - hosts: 127.0.0.1 connection: local user: root sudo: false gather_facts: false serial: 1 vars: vcenter_hostname: uk.company.local esxhost: 172.25.25.25 name: TEST-SERVER01 vmtemplate: winserver2012 * disktype: thin* * datastore: uk-datastore01* * nic_type: e1000e* * network: Web Servers* * network_type: standard* vmcluster: UK-CLUSTER username: username password: password folder: Utilities notes: Created by Ansible tasks: - name: Create VM from template vsphere_guest: vcenter_hostname: "{{ vcenter_hostname }}" username: "{{ username }}" password: "{{ password }}" guest: "{{ name }}" vm_extra_config: notes: "{{ notes }}" folder: "{{ folder }}" from_template: yes template_src: "{{ vmtemplate }}" cluster: "{{ vmcluster }}" * vm_disk:* * disk1:* * type: "{{ disktype }}"* * datastore: "{{ datastore }}"* * vm_nic:* * nic1:* * type: "{{ nic_type }}"* * network: "{{ network }}"* * network_type: "{{ network_type }}"* resource_pool: "/Resources" esxi: datacenter: UK hostname: "{{ esxhost }}" If I look at the example on the Ansible website, it doesn't look like it gives the option to allow this unless you setup a VM from an ISO file. (http://docs.ansible.com/ansible/vsphere_guest_module.html) I ant to have the same functionality if I use a template. Cheers Mark -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/3e40d2fa-b116-489f-9048-a08c93360d4e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.