ansible-collections / community.vmware

Ansible Collection for VMware
GNU General Public License v3.0
350 stars 337 forks source link

Allow a username and password to be provided when using a URL to define an OVF file in community.vmware.vmware_deploy_ovf module #2242

Open 5p4rkP1ug opened 1 week ago

5p4rkP1ug commented 1 week ago
SUMMARY

I have an OVF file stored on a web server, but it expects authentication to obtain the file. In community.vmware.vmware_deploy_ovf module, I can't define a username and password when I use url: as an OVF source.

ISSUE TYPE
COMPONENT NAME

community.vmware.vmware_deploy_ovf module

ADDITIONAL INFORMATION

Below is an example of something I'd like to achieve, but I can't because username and password aren't children of url.

 name: Deploy OVF from URL with authentication
  community.vmware.vmware_deploy_ovf:
    hostname: "{{ vsphere_server }}"
    username: "{{ vsphere_username }}"
    password: "{{ vsphere_password }}"
    folder: "{{ vsphere_folder }}"
    datacenter: "{{ vsphere_datacenter }}"
    datastore: "{{ vsphere_datastore }}"
    cluster: "{{ vsphere_cluster }}"
    resource_pool: "{{ vsphere_resource_pool|default('Resources', true) }}"
    name: "{{ vsphere_vm_name }}"
    networks: "{u'nic0':u'{{ vsphere_network }}'}"
    url: "https://supersecure.url/path/to/file.ovf"
      username: abc
      password: 123
    inject_ovf_env: true
    properties:
      ...
    power_on: false
  delegate_to: localhost
mariolenz commented 1 week ago
    url: "https://supersecure.url/path/to/file.ovf"
      username: abc
      password: 123

I'm not sure if this is possible in YAML. I guess we need to find another way to express this.

Anyway, what kind of authentication are we talking about? Basic / RFC 7617?

5p4rkP1ug commented 1 week ago
    url: "https://supersecure.url/path/to/file.ovf"
      username: abc
      password: 123

I'm not sure if this is possible in YAML. I guess we need to find another way to express this.

Anyway, what kind of authentication are we talking about? Basic / RFC 7617?

Yes, basic authentication in this scenario. Using cURL, I can provide a username and password in the following fashion and it works: https://USERNAME:PASSWORD@supersecure.url/path/to/file.ovf.

Another nice to have would also to be able to provide raw data to populate a username and password field. For example, using cURL, I can define a --data-raw attribute and provide it something like this: user=[USERNAME]&password=[PASSWORD]&submit=Log+in

5p4rkP1ug commented 1 week ago

Oh, another thing to mention whilst it crosses my mind. The URL will have parameters in it as follows: https://supersecure.url/path/to/file.ova?parameterOne=True - I should have mentioned this in my initial post.