Thanks in advance.
I want to automate EXSi steps like creating vlna, VMs and adding vSwitches and etc.
I don't have vcentre server purchased. Do I need it for this?
When I tried to login to EXSi using exsi login creds using rest api, I am getting below response.
curl -v -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'vmware-use-header-authn: test' --header 'vmware-api-session-id: null' -u 'root123' -p 'abc@123' 'https://exsitest.com/rest/com/vmware/cis/session' --insecure
Enter host password for user 'root':
* Rebuilt URL to: alef@123/
* Trying 0.0.0.123...
* Immediate connect fail for 0.0.0.123: Invalid argument
* Closing connection 0
curl: (7) Couldn't connect to server
* Trying 192.168.51.202...
* Connected to exsitest.com (192.168.51.202) port 443 (#1)
* found 148 certificates in /etc/ssl/certs/ca-certificates.crt
* found 592 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* SSL connection using TLS1.2 / ECDHE_RSA_AES_256_GCM_SHA384
* server certificate verification SKIPPED
* server certificate status verification SKIPPED
* common name: localhost.localdomain (does not match 'exsitest.com')
* server certificate expiration date OK
* server certificate activation date OK
* certificate public key: RSA
* certificate version: #3
* subject: C=US,ST=California,L=Palo Alto,O=VMware\, Inc,OU=VMware ESX Server Default Certificate,EMAILemail@example.com,CN=localhost.localdomain,1.2.840.113518.104.22.168=#1321313534323337333434342c35363464373736313732363532303439366536333265
* start date: Fri, 16 Nov 2018 13:04:04 GMT
* expire date: Fri, 17 May 2030 13:04:04 GMT
* issuer: O=VMware Installer
* compression: NULL
* ALPN, server did not agree to a protocol
* Server auth using Basic with user 'root'
> POST /rest/com/vmware/cis/session HTTP/1.1
> Host: exsitest.com
> Authorization: Basic cm9vdDphbGVmQDEyMw==
> User-Agent: curl/7.47.0
> Content-Type: application/json
> Accept: application/json
> vmware-use-header-authn: test
> vmware-api-session-id: null
< HTTP/1.1 400 Bad Request
< Date: Tue, 20 Nov 2018 13:14:38 GMT
< Connection: close
< Content-Type: text/plain; charset=utf-8
< X-Frame-Options: DENY
< Content-Length: 0
* Closing connection 1
PS: I read somewhere in the document that for vsphere automation, I can use vCli and soapAPIs for Linux. Is that the final option if I decided to not to buy the vcentre license for now. Please confirm my this understanding and let me know if there are any other options available.
No, there is no REST API with ESXi standalone. Furthermore, if you want to do automating of these things, you need vCenter Server anyhow, which does contain a partial REST API.
Thanks for the quick reply, really appreciated.
Could you please clear one of my understanding that, now I have left with 2 options if I don't buy vcentre software and want to do automation on debian server,
1. I can make a use of soap APIs, (Probably using pyvmomi python library)
2. I can use vSphere CLI for vSphere 6.7 (Which is in perl, so need to know perl first in order to make use of it)