Try this one: https://github.com/whereismyjetpack/ansible_vcenter_module
The Network Interface part works for me.

On Mon, Jun 20, 2016 at 10:09 AM, Radu Stefanache <[email protected]
> wrote:

> Hi Mark,
>
> have you got any news on this one ?
> I am currently trying to do the same thing and it does not work.
> I've tried to clone the vm/template and reconfigure it while being powered
> off but that didn't help either.
>
> Cheers
> Radu
>
> On Tuesday, February 16, 2016 at 12:31:06 PM UTC, Mark Matthews wrote:
>>
>> 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 [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/11a7d853-6e8e-44b5-a3b3-10f88a3b7de3%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/11a7d853-6e8e-44b5-a3b3-10f88a3b7de3%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAKJ_SA9FQ97KBCBtZCoA1m_%3DSnJRpcYPY2AvSUM-b9nfVnCHbA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to