VMware Cloud Community
ags97898722jkt
Contributor
Contributor
Jump to solution

Ansible & Esxi

Hi Everyone,

I'm learning VMWare virtualization automation with Ansible but i have problem as per this screenshot 

ags97898722jkt_0-1690287530286.png

My environment :

OS : Linux Centos 8.4 (ansible controller) with Ansible 2.13.5

Hypervisor : ESXI 7 update 3 (target server to be configured)

I already create key pair certificate from Centos and write the public key to Esxi on path /etc/ssh/key-roots/authorized_keys but i still facing error SSL WRONG_VERSION_NUMBER

Please help me guys

 

Reply
0 Kudos
2 Solutions

Accepted Solutions
Sachchidanand
Expert
Expert
Jump to solution

I have gone through a number of documents and found that 

1. this error is related to python version mismatch

2. Most documents show API connection over HTTPS, please see below links:

https://docs.ansible.com/ansible/2.9/scenario_guides/vmware_scenarios/vmware_requirements.html

https://docs.ansible.com/ansible/2.9/scenario_guides/vmware_scenarios/scenario_vmware_http.html

Have you tried after removing port:22 from your playbook?

Regards,

Sachchidanand

View solution in original post

tayeb2020
Contributor
Contributor
Jump to solution

can you share the yaml file

View solution in original post

Reply
0 Kudos
18 Replies
Lalegre
Virtuoso
Virtuoso
Jump to solution

Hello @ags97898722jkt,

If you are trying to reach the vAPI, it listens on HTTPS port 443, is it possible to copy the contents of your playbook here?

Reply
0 Kudos
ags97898722jkt
Contributor
Contributor
Jump to solution

Hello,

This my Ansible Playbook code

---

- hosts: localhost
  connection: local
  gather_facts: true

# vars:
# ansible_ssh_private_key_file: /home/tester/.ssh/id_rsa

  tasks:
  - name: mengecek konfigurasi VMWare ESXI Server
    community.vmware.vmware_host_facts:
         hostname: "192.168.50.5"
         username: "root@esx7-dev"
         password: "********"
         port: 22
         validate_certs: false
         delegate_to: "localhost"

Additional : 

1. Ansible collection : community.vmware 3.5.0

2. Python library for Ansible : PyVmOmi 8.0.0.1.2

3. Python : version 3.9

Reply
0 Kudos
scott28tt
VMware Employee
VMware Employee
Jump to solution

You might want to obfuscate your ESXi root password...

-------------------------------------------------------------------------------------------------------------------------------------------------------------

Although I am a VMware employee I contribute to VMware Communities voluntarily (ie. not in any official capacity)
VMware Training & Certification blog
Reply
0 Kudos
a_p_
Leadership
Leadership
Jump to solution

Moderator not: I've replaced the password with asterisks.

André

Reply
0 Kudos
ags97898722jkt
Contributor
Contributor
Jump to solution

next time i'm gonna obfuscate the password. thanks

Reply
0 Kudos
ags97898722jkt
Contributor
Contributor
Jump to solution

thanks a lot

Reply
0 Kudos
Sachchidanand
Expert
Expert
Jump to solution

Hi,

 Please try to login directly using the ssh command (using key) from ansible vm to esxi and see if any error is there. Run ssh in verbose mode to see more debugging information. Error seems to be ssl/tls version mismatch or cipher mismatch.

Also check the document and if it add any help to the issue:

https://kb.vmware.com/s/article/2151279

Regards,

Sachchidanand 

Reply
0 Kudos
ags97898722jkt
Contributor
Contributor
Jump to solution

Hello,

I've run SSH in verbose mode to login my ESXI server but there is no error regarding SSL/TLS  in the verbose

Reply
0 Kudos
Sachchidanand
Expert
Expert
Jump to solution

No error means you are able to login directly via ssh, isn't it?

Second thing is from the screenshot I can see that your playbook is running for the "localhost". Is your esxi node's entry in the inventory file as "localhost" ?

Regards,

Sachchidanand

Reply
0 Kudos
ags97898722jkt
Contributor
Contributor
Jump to solution

Hi,

Yes, i can login to ESXI using SSH successful without write password. in the playbook code the "localhost" means the code will access the PyVmOmi API then connect to ESXI using community.vmware collection

 

Reply
0 Kudos
Sachchidanand
Expert
Expert
Jump to solution

Also please confirm to which node IP 192.168.50.5 belongs to?

Regards,

Sachchidanand

Tags (1)
Reply
0 Kudos
DonData
Contributor
Contributor
Jump to solution

Try updating your urllib3 library.

python -m pip install --upgrade urllib3

---------------------------------------------------------------------------------------------------------------

Kudos are welcome and returned! Twitter@DonLowYH

Reply
0 Kudos
ags97898722jkt
Contributor
Contributor
Jump to solution

Hello,

ags97898722jkt_0-1690617327137.png

 

Reply
0 Kudos
ags97898722jkt
Contributor
Contributor
Jump to solution

Hi,

My urllib3 already the latest version, which is 2.0.4 version. i've run my playbook again, the error still same

Reply
0 Kudos
Sachchidanand
Expert
Expert
Jump to solution

I have gone through a number of documents and found that 

1. this error is related to python version mismatch

2. Most documents show API connection over HTTPS, please see below links:

https://docs.ansible.com/ansible/2.9/scenario_guides/vmware_scenarios/vmware_requirements.html

https://docs.ansible.com/ansible/2.9/scenario_guides/vmware_scenarios/scenario_vmware_http.html

Have you tried after removing port:22 from your playbook?

Regards,

Sachchidanand

ags97898722jkt
Contributor
Contributor
Jump to solution

Hello,

I modify the playbook code to be :

- hosts: localhost
  connection: local
  gather_facts: true

vars:
# ansible_ssh_private_key_file: /home/tester/.ssh/id_rsa

tasks:
- name: mengecek konfigurasi VMWare ESXI Server
  community.vmware.vmware_host_facts:
      esxi_hostname: "esx7-dev"
      hostname: "192.168.50.5"
      username: "root"
      password: "*************"
#   port: 22
     validate_certs: false
     register: konfigurasinya_adalah
delegate_to: "localhost"
- name: konfigurasi ESXI Server
  debug:
    var: konfigurasinya_adalah

This is the result

ags97898722jkt_0-1690742952328.png

I deactivate "port: 22" line

at this point this case is solved. Thanks everybody

 

 

 

Reply
0 Kudos
tayeb2020
Contributor
Contributor
Jump to solution

can you share the yaml file

Reply
0 Kudos
ags97898722jkt
Contributor
Contributor
Jump to solution

Hi @tayeb2020 

Above is my yaml file

Reply
0 Kudos