unable to create VM on esxi 7.0

287 views
Skip to first unread message

rebecca acheampong

unread,
Apr 5, 2021, 8:00:11 AM4/5/21
to Ansible Project
I am creating a virtual machine using ansible. I received this error and do not know how to solve it. I am new student to both VMware and asnible. This is the error i received:

fatal: [localhost -> localhost]: FAILED! => {"changed": false, "msg": "Unknown error while connecting to vCenter or ESXi API at vsecurity:443 : [Errno -3] Temporary failure in name resolution"}

Pleae your help is appreciated. I do not use a vcenter

Dick Visser

unread,
Apr 5, 2021, 1:16:26 PM4/5/21
to ansible...@googlegroups.com
You're connecting to a host called 'vsecurity', but that doesn't resolve to something. 
At least not on the host you're trying to run the playbook from. 

--
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-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/42014b84-ba5a-4f65-afa0-4291a393c96an%40googlegroups.com.
--
Sent from a mobile device - please excuse the brevity, spelling and punctuation.

bec1...@gmail.com

unread,
Apr 5, 2021, 1:54:15 PM4/5/21
to ansible...@googlegroups.com

Okay...thank you. I think now i am having a different error of certifiate. 

fatal: [localhost -> localhost]: FAILED! => {"changed": false, "msg": "Unable to connect to vCenter or ESXi API at vsecurity.com on TCP/443: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1123)"}

I tried to secure copy the rui.crt from vmware esxi via ssh to the ansible control node but it fails all the time.

Jean-Yves LENHOF

unread,
Apr 5, 2021, 2:13:07 PM4/5/21
to ansible...@googlegroups.com

Hi,


Please explain which module you are using when asking questions !

So have a guess that you are using this one

https://docs.ansible.com/ansible/2.8/modules/vmware_guest_module.html#vmware-guest-module

So two options :

- ask to update the certificate with a trusted and not expired one

- use "validate_certs" option

Regards,

JYL

bec1...@gmail.com

unread,
Apr 5, 2021, 3:43:57 PM4/5/21
to ansible...@googlegroups.com

Sure i will thanks. It is true, i am using the vmware_guest module where i ommited the validate certificate.
But now the problem has been with the dns. 
when I test the  management network, the hostname resolves to the dns, yet i ahve errors. 

fatal: [localhost -> localhost]: FAILED! => {"changed": false, "msg": "Unknown error while connecting to vCenter or ESXi API at vsecurity.localdomain:443 : [Errno -2] Name or service not known"}

Below is my commands....the control node is installed on the esxi

I am sorry to have been asking many questions.
---
- name: create vm
  hosts: localhost
  gather_facts: no
  connection: local

  vars:
     esxi_host: 'vsecurity.localdomain'
     VMWARE_HOST: 'vsecurity.localdomain'
     VMWARE_USER: 'root'
     VMWARE_PASSWORD: 'password'
  tasks:
   - vmware_guest:
       hostname: "{{ VMWARE_HOST }}"
       username: "{{ VMWARE_USER }}"
       validate_certs: no
       password: "{{ VMWARE_PASSWORD }}"
       folder: /Datastore_2/ans_vm/
       name: my_vm_01
       state: poweredon
       guest_id: ubuntu64Guest
       # This is hostname of particular ESXi server on which user wants VM to be deployed
       esxi_hostname: "{{ esxi_host }}"
       disk:
       - size_gb: 16
         type: thin
         datastore: Datastore_2
       hardware:
        memory_mb: 1024
         num_cpus: 1
         scsi: paravirtual
       networks:
       - name: VM Network
         mac: 00:0c:29:c2:da:5e
         ip: 192.168.154.144
         netmask: 255.255.255.0
         device_type: nvmxnet3
       wait_for_ip_address: true
     delegate_to: localhost
     register: deploy_vm


Thank you

Dick Visser

unread,
Apr 5, 2021, 5:06:25 PM4/5/21
to ansible...@googlegroups.com
Well this still is a resolution error, so that needs to be fixed.
Either way it's not an ansible problem.



bec1...@gmail.com

unread,
Apr 6, 2021, 4:29:32 AM4/6/21
to ansible...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages