Repository: ansible-collections/community.vmware

Issue:
Allow Users to Choose Content Library for OVF Deployments 
<!--- Verify first that your feature was not already discussed on GitHub -->
<!--- Complete *all* sections as described, this form is processed automatically -->

##### SUMMARY

Unlike the Module "community.vmware.vmware_content_deploy_template"  Where you have the ability to pick which Subscription you wish to deploy from. The module  Deploying OVF from Content Library doesn't have this feature, which it appears to pick at random a  subscription to deploy from. In doing so, to double the time needed for a deployment workflow.

##### ISSUE TYPE
- Add the Feature content_library 

##### COMPONENT NAME
community.vmware.vmware_content_deploy_ovf_template

##### ADDITIONAL INFORMATION
<!--- Describe how the feature would be used, why it is needed and what it would solve -->

<!--- Paste example playbooks or commands between quotes below -->
```yaml

---
    - name:
      hosts: localhost
      gather_facts: false
      connection: local
      tasks:
      - community.vmware.vmware_content_deploy_ovf_template:
          host: "{{ esxi_hostname }}"
          hostname: "{{ vcenter_hostname }}"
          username: "{{ user }}"
          password: "{{ pass }}"
          datacenter: "{{ datacenter }}"
          cluster: "{{ cluster }}"
           content_library: "{{ library_name }}" 
          datastore: "{{ datastore }}"
          resource_pool: "{{ vmname }}-resource"
          validate_certs: False
          folder: vm
          ovf_template: "{{ TemplateName }}"
          name: "{{ vmname }}"
        delegate_to: localhost

```

<!--- HINT: You can also paste gist.github.com links for larger files -->



Discussion:

Resolving patch:
diff --git a/plugins/modules/vmware_content_deploy_ovf_template.py b/plugins/modules/vmware_content_deploy_ovf_template.py
--- a/plugins/modules/vmware_content_deploy_ovf_template.py
+++ b/plugins/modules/vmware_content_deploy_ovf_template.py
@@ -29,6 +29,12 @@
       type: str
       required: True
       aliases: ['ovf', 'template_src']
+    content_library:
+      description:
+      - The name of the content library from where the template resides.
+      type: str
+      required: False
+      version_added: '1.5.0'
     name:
       description:
       - The name of the VM to be deployed.
@@ -132,6 +138,7 @@ def __init__(self, module):
         """Constructor."""
         super(VmwareContentDeployOvfTemplate, self).__init__(module)
         self.ovf_template_name = self.params.get('ovf_template')
+        self.content_library_name = self.params.get('content_library')
         self.vm_name = self.params.get('name')
         self.datacenter = self.params.get('datacenter')
         self.datastore = self.params.get('datastore')
@@ -151,9 +158,15 @@ def deploy_vm_from_ovf_template(self):
         if not self.datastore_id:
             self.module.fail_json(msg="Failed to find the datastore %s" % self.datastore)
         # Find the LibraryItem (Template) by the given LibraryItem name
-        self.library_item_id = self.get_library_item_by_name(self.ovf_template_name)
-        if not self.library_item_id:
-            self.module.fail_json(msg="Failed to find the library Item %s" % self.ovf_template_name)
+        if self.content_library_name:
+            self.library_item_id = self.get_library_item_from_content_library_name(
+                self.ovf_template_name, self.content_library_name)
+            if not self.library_item_id:
+                self.module.fail_json(msg="Failed to find the library Item %s in content library %s" % (self.ovf_template_name, self.content_library_name))
+        else:
+            self.library_item_id = self.get_library_item_by_name(self.ovf_template_name)
+            if not self.library_item_id:
+                self.module.fail_json(msg="Failed to find the library Item %s" % self.ovf_template_name)
         # Find the folder by the given folder name
         self.folder_id = self.get_folder_by_name(self.datacenter, self.folder)
         if not self.folder_id:
@@ -221,6 +234,7 @@ def main():
     argument_spec = VmwareRestClient.vmware_client_argument_spec()
     argument_spec.update(
         ovf_template=dict(type='str', aliases=['template_src', 'ovf'], required=True),
+        content_library=dict(type='str', required=False),
         name=dict(type='str', required=True, aliases=['vm_name']),
         datacenter=dict(type='str', required=True),
         datastore=dict(type='str', required=True),


Test patch: