Thanks. But I already have name and vlan in network section.

I'm not sure about my template. I'll check the network configuration on it.

I'm trying to create Linux vms (centos).

reza.

Le 17 oct. 2017 09:07, "'J Hawkesworth' via Ansible Project" <
[email protected]> a écrit :

> From what I have read, you need to specify a 'name' and 'vlan' parameter
> for each network interface you want configured in your clone, so maybe just
> add a
>
>  - name: network2
>    vlan: some_vlan_id
>
> into to the 'networks' section?
>
> You don't mention what OS you are installing but something I have found
> while trying to clone windows VMs is that it is important to remove device
> drivers for any network devices which are no longer present (You can do
> this by starting Device Manager (devmgmt.msc) and clicking on 'Show hidden
> devices' on the View menu. I don't know if the same is true for other
> operating systems.
>
> I haven't looked at the code, but I don't think you can set the custom
> values that you are trying to set.  Maybe you can set up templates with
> these values set and then just select the correct template.  You can set
> number of cpus num_cpus and the memory allocation memory_mb in the
> 'hardware' section though (at least in ansible 2.4):
> http://docs.ansible.com/ansible/latest/vmware_guest_module.html
>
> While I am on, I've also found that it is important to set the networking
> up in the same way in your template, at least on windows.  So if you want
> to have static IPs in your cloned VMs make sure you have set up a static ip
> in your template VM before you convert it to a template.
>
> Hope this helps,
>
> Jon
>
> On Monday, October 16, 2017 at 4:29:33 PM UTC+1, Reza Issany wrote:
>>
>> Hi,
>>
>> Forgive me for my bad english.
>>
>> I'm actually experiencing some problems using the vmare_guest module. I
>> want to create vms on vmware using this module.
>> When I create a new vm, the two nic cards are not connected at boot. This
>> is the first problem.
>> The second one is that I can't change the number of cores per vcpu and
>> other specific configurations.
>>
>> I tried to set custom values using customvalues:
>> customvalues:
>>       - key: "ethernet0.startConnected"
>>         value: true
>>       - key: "cpuid.coresPerSocket"
>>         value: 1
>>
>> I have tested with ansible 2.3, 2.4 and 2.5 (from github). I can't find
>> any documentation to set customvalues.
>> How do you do this ? Thanks.
>>
>> The totally code :
>> - name: "Creating a VM based on template"
>>   vmware_guest:
>>     datacenter: "DC1"
>>     cluster: "mycluster"
>>     hostname: "{{ vcenter_host }}"
>>     username: "{{ vcenter_user }}"
>>     password: "{{ vcenter_password }}"
>>     validate_certs: no
>>     folder: {{ v_folder |default("/") }}
>>     name: "{{ v_hostname }}"
>>     annotation: "{{ ansible_date_time.date }} - VM creation {{ v_hostname
>> }} using ansible"
>>     state: poweredon
>>     template: "{{ vmware_template }}"
>>     customvalues:
>>       - key: "vcpu.hotadd"
>>         values: "yes"
>>       - key: "mem.hotadd"
>>         value: "yes"
>>       - key: "ethernet0.startConnected"
>>         value: true
>>       - key: "cpuid.coresPerSocket"
>>         value: 1
>>     disk:
>>       - disk1:
>>         size_gb: 20
>>         type: "{{ v_disk_type }}"
>>         datastore: "mydatastore"
>>       - disk2:
>>         size_gb: "{{ v_disk_size }}"
>>         type: "{{ v_disk_type }}"
>>         datastore: "mydatastore"
>>     hardware:
>>       memory_mb: "{{ v_memory_size }}"
>>       num_cpus: "{{ v_cpu_number }}"
>>       scsi: paravirtual
>>     networks:
>>       - name: "{{ vmware_network }}"
>>         vlan: "{{ v_vlan_id }}"
>>         device_type: "e1000"
>>         type: "static"
>>         ip: "{{ v_ip }}"
>>         netmask: "{{ v_netmask | default('255.255.255.0') }}"
>>         gateway: "{{ v_gateway }}"
>>   register: deploy
>>   when: do_action == "new"
>>   delegate_to: localhost
>>   tags: createvm
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/ansible-project/jnf9cpT27U0/unsubscribe.
> To unsubscribe from this group and all its topics, 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/73007a44-5483-4d14-89ef-94efa8c717f1%40googlegroups.
> com
> <https://groups.google.com/d/msgid/ansible-project/73007a44-5483-4d14-89ef-94efa8c717f1%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/CAAxzbSS_a%3DXH6wpKexMjdf%3DwYrhers-YYxyXhShFPzKsqWEaQQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to