Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updating lookup docs to be more descriptive #503

Conversation

mikemorency
Copy link
Collaborator

SUMMARY

The lookup plugin documentation needs to be updated. Its missing useful examples, inconsistent, and can be vague. These changes should address those issues.

ISSUE TYPE
  • Docs Pull Request
COMPONENT NAME

all lookup plugins (plugins/lookup/*)

@mikemorency mikemorency force-pushed the mm-feature/update-lookup-docs branch from f8fc37b to 72e221b Compare July 30, 2024 18:19
Copy link

codecov bot commented Jul 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 34.20%. Comparing base (de4b81c) to head (6564e2d).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #503   +/-   ##
=======================================
  Coverage   34.20%   34.20%           
=======================================
  Files         143      143           
  Lines       11032    11032           
  Branches     2279     2279           
=======================================
  Hits         3774     3774           
  Misses       7258     7258           
Flag Coverage Δ
sanity 34.20% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor


# Alternatively, you can add the connection arguments to a dictionary variable, and then pass that variable to the
# lookup plugins. This makes the individual lookup plugin calls simpler
- name: Set Connection Argument Variable
ansible.builtin.set_fact:
Copy link
Contributor

@bcoca bcoca Jul 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better than setting fact, use a block and set this in the vars: section of it, avoids a lot of memory misuse for data that is not really host specific. You can also use the block name instead for the extra info instead of comments as some documentation tools will strip the comments.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, thats a good tip. I am not sure a block makes sense here though, since the example is showing the user can set this auth variable once early in the playbook and then reference it throughout the play.
I could update the example to be a stub playbook though? like

- hosts: all
  vars:
    connection_args:
      .....
  tasks:
    - debug: ...

Copy link
Contributor

Copy link
Contributor

@mikemorency
Copy link
Collaborator Author

@mariolenz @bardielle
These zuul builds seem broken unrelated to my change, im not sure how to go about fixing them.

https://ansible.softwarefactory-project.io/zuul/build/43290fd054634db9a13e116f54b79853 - this build shows that no datastores are present on the cluster, and then fails because its trying to create a vm and cant find the specified datastore

https://ansible.softwarefactory-project.io/zuul/build/4f0cd2db3c8e4f7995f3a5c984802c13 - this build is trying to run a tox job that no longer exists. It was removed in a previous commit 29688ba

@bardielle
Copy link
Collaborator

@alinabuzachis can you review it as well?

@mariolenz mariolenz mentioned this pull request Aug 4, 2024
@mariolenz
Copy link
Collaborator

I don't understand the CI failure. I've opened #507 to investigate how to fix this.

@mikemorency
Copy link
Collaborator Author

recheck

Copy link
Contributor

Copy link
Collaborator

@alinabuzachis alinabuzachis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mikemorency I left some small suggestions.

plugins/lookup/vm_moid.py Outdated Show resolved Hide resolved
plugins/lookup/cluster_moid.py Outdated Show resolved Hide resolved
plugins/lookup/cluster_moid.py Outdated Show resolved Hide resolved
plugins/lookup/cluster_moid.py Outdated Show resolved Hide resolved
plugins/lookup/datacenter_moid.py Outdated Show resolved Hide resolved
plugins/lookup/resource_pool_moid.py Outdated Show resolved Hide resolved
plugins/lookup/resource_pool_moid.py Outdated Show resolved Hide resolved
plugins/lookup/resource_pool_moid.py Outdated Show resolved Hide resolved
plugins/lookup/vm_moid.py Outdated Show resolved Hide resolved
plugins/lookup/vm_moid.py Outdated Show resolved Hide resolved
@mikemorency mikemorency force-pushed the mm-feature/update-lookup-docs branch from d2dea5b to 98c0d0c Compare August 6, 2024 13:59
Copy link

github-actions bot commented Aug 6, 2024

Docs Build 📝

Thank you for contribution!✨

The docsite for this PR is available for download as an artifact from this run:
https://github.com/ansible-collections/vmware.vmware_rest/actions/runs/10268040055

You can compare to the docs for the main branch here:
https://ansible-collections.github.io/vmware.vmware_rest/branch/main

File changes:

  • M collections/vmware/vmware_rest/cluster_moid_lookup.html
  • M collections/vmware/vmware_rest/datacenter_moid_lookup.html
  • M collections/vmware/vmware_rest/datastore_moid_lookup.html
  • M collections/vmware/vmware_rest/folder_moid_lookup.html
  • M collections/vmware/vmware_rest/host_moid_lookup.html
  • M collections/vmware/vmware_rest/network_moid_lookup.html
  • M collections/vmware/vmware_rest/resource_pool_moid_lookup.html
  • M collections/vmware/vmware_rest/vm_moid_lookup.html
Click to see the diff comparison.

NOTE: only file modifications are shown here. New and deleted files are excluded.
See the file list and check the published docs to see those files.

The diff output was truncated because it exceeded the maximum size.

diff --git a/home/runner/work/vmware.vmware_rest/vmware.vmware_rest/docsbuild/base/collections/vmware/vmware_rest/cluster_moid_lookup.html b/home/runner/work/vmware.vmware_rest/vmware.vmware_rest/docsbuild/head/collections/vmware/vmware_rest/cluster_moid_lookup.html
index c9c15cd..a9391f1 100644
--- a/home/runner/work/vmware.vmware_rest/vmware.vmware_rest/docsbuild/base/collections/vmware/vmware_rest/cluster_moid_lookup.html
+++ b/home/runner/work/vmware.vmware_rest/vmware.vmware_rest/docsbuild/head/collections/vmware/vmware_rest/cluster_moid_lookup.html
@@ -182,7 +182,10 @@ see <a class="reference internal" href="#ansible-collections-vmware-vmware-rest-
 <div class="ansibleOptionAnchor" id="parameter-_terms"></div><p class="ansible-option-title" id="ansible-collections-vmware-vmware-rest-cluster-moid-lookup-parameter-terms"><strong>Terms</strong></p>
 <a class="ansibleOptionLink" href="#parameter-_terms" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span> / <span class="ansible-option-required">required</span></p>
 </div></td>
-<td><div class="ansible-option-cell"><p>Path to query.</p>
+<td><div class="ansible-option-cell"><p>The absolute folder path to the object you would like to lookup.</p>
+<p>Folder paths always start with the datacenter name, and then the object type (host, vm, network, datastore).</p>
+<p>If the object is in a sub folder, the sub folder path should be added after the object type (for example /my_dc/vm/some/sub_folder/vm_name_to_lookup).</p>
+<p>Enter the object or folder names as seen in the VCenter GUI. Do not escape spaces or special characters.</p>
 </div></td>
 </tr>
 </tbody>
@@ -200,6 +203,15 @@ examples: <code class="docutils literal notranslate"><span class="pre">lookup('v
 </thead>
 <tbody>
 <tr class="row-even"><td><div class="ansible-option-cell">
+<div class="ansibleOptionAnchor" id="parameter-object_type"></div><p class="ansible-option-title" id="ansible-collections-vmware-vmware-rest-cluster-moid-lookup-parameter-object-type"><strong>object_type</strong></p>
+<a class="ansibleOptionLink" href="#parameter-object_type" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
+</div></td>
+<td><div class="ansible-option-cell"><p>Should not be set by the user, it is set internally when using a specific lookup plugin.</p>
+<p>Describes the type of object to lookup. Example, cluster, datacenter, datastore, etc.</p>
+<p class="ansible-option-line"><strong class="ansible-option-default-bold">Default:</strong> <code class="ansible-option-default docutils literal notranslate"><span class="pre">&quot;cluster&quot;</span></code></p>
+</div></td>
+</tr>
+<tr class="row-odd"><td><div class="ansible-option-cell">
 <div class="ansibleOptionAnchor" id="parameter-vcenter_hostname"></div><p class="ansible-option-title" id="ansible-collections-vmware-vmware-rest-cluster-moid-lookup-parameter-vcenter-hostname"><strong>vcenter_hostname</strong></p>
 <a class="ansibleOptionLink" href="#parameter-vcenter_hostname" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span> / <span class="ansible-option-required">required</span></p>
 </div></td>
@@ -210,7 +222,7 @@ examples: <code class="docutils literal notranslate"><span class="pre">lookup('v
 </ul>
 </div></td>
 </tr>
-<tr class="row-odd"><td><div class="ansible-option-cell">
+<tr class="row-even"><td><div class="ansible-option-cell">
 <div class="ansibleOptionAnchor" id="parameter-vcenter_password"></div><p class="ansible-option-title" id="ansible-collections-vmware-vmware-rest-cluster-moid-lookup-parameter-vcenter-password"><strong>vcenter_password</strong></p>
 <a class="ansibleOptionLink" href="#parameter-vcenter_password" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span> / <span class="ansible-option-required">required</span></p>
 </div></td>
@@ -221,7 +233,7 @@ examples: <code class="docutils literal notranslate"><span class="pre">lookup('v
 </ul>
 </div></td>
 </tr>
-<tr class="row-even"><td><div class="ansible-option-cell">
+<tr class="row-odd"><td><div class="ansible-option-cell">
 <div class="ansibleOptionAnchor" id="parameter-vcenter_rest_log_file"></div><p class="ansible-option-title" id="ansible-collections-vmware-vmware-rest-cluster-moid-lookup-parameter-vcenter-rest-log-file"><strong>vcenter_rest_log_file</strong></p>
 <a class="ansibleOptionLink" href="#parameter-vcenter_rest_log_file" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
 </div></td>
@@ -234,7 +246,7 @@ examples: <code class="docutils literal notranslate"><span class="pre">lookup('v
 </ul>
 </div></td>
 </tr>
-<tr class="row-odd"><td><div class="ansible-option-cell">
+<tr class="row-even"><td><div class="ansible-option-cell">
 <div class="ansibleOptionAnchor" id="parameter-vcenter_username"></div><p class="ansible-option-title" id="ansible-collections-vmware-vmware-rest-cluster-moid-lookup-parameter-vcenter-username"><strong>vcenter_username</strong></p>
 <a class="ansibleOptionLink" href="#parameter-vcenter_username" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span> / <span class="ansible-option-required">required</span></p>
 </div></td>
@@ -245,7 +257,7 @@ examples: <code class="docutils literal notranslate"><span class="pre">lookup('v
 </ul>
 </div></td>
 </tr>
-<tr class="row-even"><td><div class="ansible-option-cell">
+<tr class="row-odd"><td><div class="ansible-option-cell">
 <div class="ansibleOptionAnchor" id="parameter-vcenter_validate_certs"></div><p class="ansible-option-title" id="ansible-collections-vmware-vmware-rest-cluster-moid-lookup-parameter-vcenter-validate-certs"><strong>vcenter_validate_certs</strong></p>
 <a class="ansibleOptionLink" href="#parameter-vcenter_validate_certs" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
 </div></td>
@@ -271,24 +283,106 @@ examples: <code class="docutils literal notranslate"><span class="pre">lookup('v
 <ul class="simple">
 <li><p>When keyword and positional parameters are used together, positional parameters must be listed before keyword parameters:
 <code class="docutils literal notranslate"><span class="pre">lookup('vmware.vmware_rest.cluster_moid',</span> <span class="pre">term1,</span> <span class="pre">term2,</span> <span class="pre">key1=value1,</span> <span class="pre">key2=value2)</span></code> and <code class="docutils literal notranslate"><span class="pre">query('vmware.vmware_rest.cluster_moid',</span> <span class="pre">term1,</span> <span class="pre">term2,</span> <span class="pre">key1=value1,</span> <span class="pre">key2=value2)</span></code></p></li>
+<li><p>Lookup plugins are run on the ansible controller and are used to lookup information from an external resource. See <a class="reference external" href="https://docs.ansible.com/ansible/latest/plugins/lookup.html#lookup-plugins">https://docs.ansible.com/ansible/latest/plugins/lookup.html#lookup-plugins</a></p></li>
+<li><p>This collection’s plugins allow you to quickly gather VMWare resource identifiers and either store or use them, instead of requiring multiple modules and tasks to do the same thing. See the examples section for a comparison.</p></li>
 </ul>
 </div>
 </section>
 <section id="examples">
 <h2><a class="toc-backref" href="#id6" role="doc-backlink">Examples</a><a class="headerlink" href="#examples" title="Link to this heading"></a></h2>
-<div class="highlight-yaml+jinja notranslate"><div class="highlight"><pre><span></span><span class="c1"># lookup sample</span>
-<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">set connection info</span>
-<span class="w">  </span><span class="nt">ansible.builtin.set_fact</span><span class="p">:</span>
+<div class="highlight-yaml+jinja notranslate"><div class="highlight"><pre><span></span><span class="c1">#</span>
+<span class="c1">#</span>
+<span class="c1"># The examples below assume you have a datacenter named &#39;my_dc&#39; and a cluster named &#39;my_cluster&#39;.</span>
+<span class="c1"># Replace these values as needed for your environment.</span>
+<span class="c1">#</span>
+<span class="c1">#</span>
+
+<span class="c1">#</span>
+<span class="c1"># Authentication / Connection Arguments</span>
+<span class="c1">#</span>
+<span class="c1"># You can explicitly set the connection arguments in each lookup. This may be clearer for some use cases</span>
+<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Pass In Connection Arguments Explicitly</span>
+<span class="w">  </span><span class="nt">ansible.builtin.debug</span><span class="p">:</span>
+<span class="w">    </span><span class="nt">msg</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">&gt;-</span>
+<span class="w">      </span><span class="cp">{{</span> <span class="nv">lookup</span><span class="o">(</span><span class="s1">&#39;vmware.vmware_rest.cluster_moid&#39;</span><span class="o">,</span> <span class="s1">&#39;/my_dc/host/my_cluster&#39;</span><span class="o">,</span>
+      <span class="nv">vcenter_hostname</span><span class="o">=</span><span class="s2">&quot;vcenter.test&quot;</span><span class="o">,</span>
+      <span class="nv">vcenter_username</span><span class="o">=</span><span class="s2">&quot;administrator@vsphere.local&quot;</span><span class="o">,</span>
+      <span class="nv">vcenter_password</span><span class="o">=</span><span class="s2">&quot;1234&quot;</span><span class="o">)</span> <span class="cp">}}</span>
+
+<span class="c1"># Alternatively, you can add the connection arguments to a dictionary variable, and then pass that variable to the</span>
+<span class="c1"># lookup plugins. This makes the individual lookup plugin calls simpler</span>
+<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Example Playbook</span>
+<span class="w">  </span><span class="nt">hosts</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">all</span>
+<span class="w">  </span><span class="nt">vars</span><span class="p">:</span>
 <span class="w">    </span><span class="nt">connection_args</span><span class="p">:</span>
 <span class="w">      </span><span class="nt">vcenter_hostname</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;vcenter.test&quot;</span>
 <span class="w">      </span><span class="nt">vcenter_username</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;administrator@vsphere.local&quot;</span>
 <span class="w">      </span><span class="nt">vcenter_password</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;1234&quot;</span>
+<span class="w">  </span><span class="nt">tasks</span><span class="p">:</span>
+<span class="w">    </span><span class="c1"># Add more tasks or lookups as needed, referencing the same connection_args variable</span>
+<span class="w">    </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Lookup MoID of the object</span>
+<span class="w">      </span><span class="nt">ansible.builtin.debug</span><span class="p">:</span>
+<span class="w">        </span><span class="nt">msg</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">lookup</span><span class="o">(</span><span class="s1">&#39;vmware.vmware_rest.cluster_moid&#39;</span><span class="o">,</span> <span class="s1">&#39;/my_dc/host/my_cluster&#39;</span><span class="o">,</span> <span class="o">**</span><span class="nv">connection_args</span><span class="o">)</span> <span class="cp">}}</span><span class="s">&quot;</span>
 
-<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">lookup MoID of the object</span>
-<span class="w">  </span><span class="nt">ansible.builtin.debug</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">msg=&quot;</span><span class="cp">{{</span> <span class="nv">lookup</span><span class="o">(</span><span class="s1">&#39;vmware.vmware_rest.cluster_moid&#39;</span><span class="o">,</span> <span class="s1">&#39;/my_dc/host/my_cluster&#39;</span><span class="o">,</span> <span class="o">**</span><span class="nv">connection_args</span><span class="o">)</span> <span class="cp">}}</span><span class="l l-Scalar l-Scalar-Plain">&quot;</span>
+<span class="c1"># Finally, you can also leverage the environment variables associated with each connection arg, and avoid passing</span>
+<span class="c1"># extra args to the lookup plugins</span>
+<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Use a lookup plugin with VMWARE_* environment variables set</span>
+<span class="w">  </span><span class="nt">ansible.builtin.debug</span><span class="p">:</span>
+<span class="w">    </span><span class="nt">msg</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">lookup</span><span class="o">(</span><span class="s1">&#39;vmware.vmware_rest.cluster_moid&#39;</span><span class="o">,</span> <span class="s1">&#39;/my_dc/host/my_cluster&#39;</span><span class="o">)</span> <span class="cp">}}</span><span class="s">&quot;</span>
 
-<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">lookup MoID of the object inside the path</span>
-<span class="w">  </span><span class="nt">ansible.builtin.debug</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">msg=&quot;</span><span class="cp">{{</span> <span class="nv">lookup</span><span class="o">(</span><span class="s1">&#39;vmware.vmware_rest.cluster_moid&#39;</span><span class="o">,</span> <span class="s1">&#39;/my_dc/host/&#39;</span><span class="o">)</span> <span class="cp">}}</span><span class="l l-Scalar l-Scalar-Plain">&quot;</span>
+<span class="c1">#</span>
+<span class="c1"># Cluster Search Path Examples</span>
+<span class="c1">#</span>
+<span class="c1"># Clusters are located under the &#39;host&#39; folder in a datacenter.</span>
+<span class="c1"># The basic path for a cluster should look like &#39;/&lt;datacenter-name&gt;/host/&lt;cluster-name&gt;&#39;</span>
+<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Lookup Cluster Named &#39;my_cluster&#39; in Datacenter &#39;my_dc&#39;</span>
+<span class="w">  </span><span class="nt">ansible.builtin.debug</span><span class="p">:</span>
+<span class="w">    </span><span class="nt">msg</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">lookup</span><span class="o">(</span><span class="s1">&#39;vmware.vmware_rest.cluster_moid&#39;</span><span class="o">,</span> <span class="s1">&#39;/my_dc/host/my_cluster&#39;</span><span class="o">)</span> <span class="cp">}}</span><span class="s">&quot;</span>
+
+<span class="c1">#</span>
+<span class="c1"># Usage in Playbooks</span>
+<span class="c1">#</span>
+<span class="c1">#</span>
+<span class="c1"># The lookup plugin can be used to simplify your playbook. Here is an example of how you might use it.</span>
+<span class="c1">#</span>
+<span class="c1"># Without the lookup, this takes two modules which both run on the remote host. This can slow down execution</span>
+<span class="c1"># and adds extra steps to the playbook:</span>
+<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Retrieve details about a cluster named &#39;my_cluster&#39;</span>
+<span class="w">  </span><span class="nt">vmware.vmware_rest.vcenter_cluster_info</span><span class="p">:</span>
+<span class="w">    </span><span class="nt">names</span><span class="p">:</span>
+<span class="w">      </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">my_cluster</span>
+<span class="w">  </span><span class="nt">register</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">my_cluster_info</span>
+
+<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Create a VM</span>
+<span class="w">  </span><span class="nt">vmware.vmware_rest.vcenter_vm</span><span class="p">:</span>
+<span class="w">    </span><span class="nt">placement</span><span class="p">:</span>
+<span class="w">      </span><span class="nt">cluster</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">my_cluster_info.value</span><span class="o">[</span><span class="m">0</span><span class="o">]</span><span class="nv">.cluster</span> <span class="cp">}}</span><span class="s">&quot;</span>
+<span class="w">    </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">test_vm1</span>
+<span class="w">    </span><span class="nt">guest_OS</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">RHEL_7_64</span>
+<span class="w">    </span><span class="nt">hardware_version</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">VMX_11</span>
+<span class="w">    </span><span class="nt">memory</span><span class="p">:</span>
+<span class="w">      </span><span class="nt">size_MiB</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">1024</span>
+<span class="w">    </span><span class="nt">disks</span><span class="p">:</span>
+<span class="w">      </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">type</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">SATA</span>
+<span class="w">        </span><span class="nt">new_vmdk</span><span class="p">:</span>
+<span class="w">          </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">first_disk</span>
+<span class="w">          </span><span class="nt">capacity</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">3200</span>
+
+<span class="c1"># With the lookup, playbooks are shorter, quicker, and more intuitive:</span>
+<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Create a VM</span>
+<span class="w">  </span><span class="nt">vmware.vmware_rest.vcenter_vm</span><span class="p">:</span>
+<span class="w">    </span><span class="nt">placement</span><span class="p">:</span>
+<span class="w">      </span><span class="nt">cluster</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">lookup</span><span class="o">(</span><span class="s1">&#39;vmware.vmware_rest.cluster_moid&#39;</span><span class="o">,</span> <span class="s1">&#39;/my_dc/host/my_cluster&#39;</span><span class="o">)</span> <span class="cp">}}</span><span class="s">&quot;</span>
+<span class="w">    </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">test_vm1</span>
+<span class="w">    </span><span class="nt">guest_OS</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">RHEL_7_64</span>
+<span class="w">    </span><span class="nt">hardware_version</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">VMX_11</span>
+<span class="w">    </span><span class="nt">memory</span><span class="p">:</span>
+<span class="w">      </span><span class="nt">size_MiB</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">1024</span>
+<span class="w">    </span><span class="nt">disks</span><span class="p">:</span>
+<span class="w">      </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">type</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">SATA</span>
+<span class="w">        </span><span class="nt">new_vmdk</span><span class="p">:</span>
+<span class="w">          </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">first_disk</span>
+<span class="w">          </span><span class="nt">capacity</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">3200</span>
 </pre></div>
 </div>
 </section>
diff --git a/home/runner/work/vmware.vmware_rest/vmware.vmware_rest/docsbuild/base/collections/vmware/vmware_rest/datacenter_moid_lookup.html b/home/runner/work/vmware.vmware_rest/vmware.vmware_rest/docsbuild/head/collections/vmware/vmware_rest/datacenter_moid_lookup.html
index e25cdc3..355472e 100644
--- a/home/runner/work/vmware.vmware_rest/vmware.vmware_rest/docsbuild/base/collections/vmware/vmware_rest/datacenter_moid_lookup.html
+++ b/home/runner/work/vmware.vmware_rest/vmware.vmware_rest/docsbuild/head/collections/vmware/vmware_rest/datacenter_moid_lookup.html
@@ -182,7 +182,10 @@ see <a class="reference internal" href="#ansible-collections-vmware-vmware-rest-
 <div class="ansibleOptionAnchor" id="parameter-_terms"></div><p class="ansible-option-title" id="ansible-collections-vmware-vmware-rest-datacenter-moid-lookup-parameter-terms"><strong>Terms</strong></p>
 <a class="ansibleOptionLink" href="#parameter-_terms" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span> / <span class="ansible-option-required">required</span></p>
 </div></td>
-<td><div class="ansible-option-cell"><p>Path to query.</p>
+<td><div class="ansible-option-cell"><p>The absolute folder path to the object you would like to lookup.</p>
+<p>Folder paths always start with the datacenter name, and then the object type (host, vm, network, datastore).</p>
+<p>If the object is in a sub folder, the sub folder path should be added after the object type (for example /my_dc/vm/some/sub_folder/vm_name_to_lookup).</p>
+<p>Enter the object or folder names as seen in the VCenter GUI. Do not escape spaces or special characters.</p>
 </div></td>
 </tr>
 </tbody>
@@ -200,6 +203,15 @@ examples: <code class="docutils literal notranslate"><span class="pre">lookup('v
 </thead>
 <tbody>
 <tr class="row-even"><td><div class="ansible-option-cell">
+<div class="ansibleOptionAnchor" id="parameter-object_type"></div><p class="ansible-option-title" id="ansible-collections-vmware-vmware-rest-datacenter-moid-lookup-parameter-object-type"><strong>object_type</strong></p>
+<a class="ansibleOptionLink" href="#parameter-object_type" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
+</div></td>
+<td><div class="ansible-option-cell"><p>Should not be set by the user, it is set internally when using a specific lookup plugin.</p>
+<p>Describes the type of object to lookup. Example, cluster, datacenter, datastore, etc.</p>
+<p class="ansible-option-line"><strong class="ansible-option-default-bold">Default:</strong> <code class="ansible-option-default docutils literal notranslate"><span class="pre">&quot;cluster&quot;</span></code></p>
+</div></td>
+</tr>
+<tr class="row-odd"><td><div class="ansible-option-cell">
 <div class="ansibleOptionAnchor" id="parameter-vcenter_hostname"></div><p class="ansible-option-title" id="ansible-collections-vmware-vmware-rest-datacenter-moid-lookup-parameter-vcenter-hostname"><strong>vcenter_hostname</strong></p>
 <a class="ansibleOptionLink" href="#parameter-vcenter_hostname" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span> / <span class="ansible-option-required">required</span></p>
 </div></td>
@@ -210,7 +222,7 @@ examples: <code class="docutils literal notranslate"><span class="pre">lookup('v
 </ul>
 </div></td>
 </tr>
-<tr class="row-odd"><td><div class="ansible-option-cell">
+<tr class="row-even"><td><div class="ansible-option-cell">
 <div class="ansibleOptionAnchor" id="parameter-vcenter_password"></div><p class="ansible-option-title" id="ansible-collections-vmware-vmware-rest-datacenter-moid-lookup-parameter-vcenter-password"><strong>vcenter_password</strong></p>
 <a class="ansibleOptionLink" href="#parameter-vcenter_password" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span> / <span class="ansible-option-required">required</span></p>
 </div></td>
@@ -221,7 +233,7 @@ examples: <code class="docutils literal notranslate"><span class="pre">lookup('v
 </ul>
 </div></td>
 </tr>
-<tr class="row-even"><td><div class="ansible-option-cell">
+<tr class="row-odd"><td><div class="ansible-option-cell">
 <div class="ansibleOptionAnchor" id="parameter-vcenter_rest_log_file"></div><p class="ansible-option-title" id="ansible-collections-vmware-vmware-rest-datacenter-moid-lookup-parameter-vcenter-rest-log-file"><strong>vcenter_rest_log_file</strong></p>
 <a class="ansibleOptionLink" href="#parameter-vcenter_rest_log_file" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
 </div></td>
@@ -234,7 +246,7 @@ examples: <code class="docutils literal notranslate"><span class="pre">lookup('v
 </ul>
 </div></td>
 </tr>
-<tr class="row-odd"><td><div class="ansible-option-cell">
+<tr class="row-even"><td><div class="ansible-option-cell">
 <div class="ansibleOptionAnchor" id="parameter-vcenter_username"></div><p class="ansible-option-title" id="ansible-collections-vmware-vmware-rest-datacenter-moid-lookup-parameter-vcenter-username"><strong>vcenter_username</strong></p>
 <a class="ansibleOptionLink" href="#parameter-vcenter_username" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span> / <span class="ansible-option-required">required</span></p>
 </div></td>
@@ -245,7 +257,7 @@ examples: <code class="docutils literal notranslate"><span class="pre">lookup('v
 </ul>
 </div></td>
 </tr>
-<tr class="row-even"><td><div class="ansible-option-cell">
+<tr class="row-odd"><td><div class="ansible-option-cell">
 <div class="ansibleOptionAnchor" id="parameter-vcenter_validate_certs"></div><p class="ansible-option-title" id="ansible-collections-vmware-vmware-rest-datacenter-moid-lookup-parameter-vcenter-validate-certs"><strong>vcenter_validate_certs</strong></p>
 <a class="ansibleOptionLink" href="#parameter-vcenter_validate_certs" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
 </div></td>
@@ -271,24 +283,105 @@ examples: <code class="docutils literal notranslate"><span class="pre">lookup('v
 <ul class="simple">
 <li><p>When keyword and positional parameters are used together, positional parameters must be listed before keyword parameters:
 <code class="docutils literal notranslate"><span class="pre">lookup('vmware.vmware_rest.datacenter_moid',</span> <span class="pre">term1,</span> <span class="pre">term2,</span> <span class="pre">key1=value1,</span> <span class="pre">key2=value2)</span></code> and <code class="docutils literal notranslate"><span class="pre">query('vmware.vmware_rest.datacenter_moid',</span> <span class="pre">term1,</span> <span class="pre">term2,</span> <span class="pre">key1=value1,</span> <span class="pre">key2=value2)</span></code></p></li>
+<li><p>Lookup plugins are run on the ansible controller and are used to lookup information from an external resource. See <a class="reference external" href="https://docs.ansible.com/ansible/latest/plugins/lookup.html#lookup-plugins">https://docs.ansible.com/ansible/latest/plugins/lookup.html#lookup-plugins</a></p></li>
+<li><p>This collection’s plugins allow you to quickly gather VMWare resource identifiers and either store or use them, instead of requiring multiple modules and tasks to do the same thing. See the examples section for a comparison.</p></li>
 </ul>
 </div>
 </section>
 <section id="examples">
 <h2><a class="toc-backref" href="#id6" role="doc-backlink">Examples</a><a class="headerlink" href="#examples" title="Link to this heading"></a></h2>
-<div class="highlight-yaml+jinja notranslate"><div class="highlight"><pre><span></span><span class="c1"># lookup sample</span>
-<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">set connection info</span>
-<span class="w">  </span><span class="nt">ansible.builtin.set_fact</span><span class="p">:</span>
+<div class="highlight-yaml+jinja notranslate"><div class="highlight"><pre><span></span><span class="c1">#</span>
+<span class="c1">#</span>
+<span class="c1"># The examples below assume you have a datacenter named &#39;my_dc&#39;.</span>
+<span class="c1"># Replace these values as needed for your environment.</span>
+<span class="c1">#</span>
+<span class="c1">#</span>
+
+<span class="c1">#</span>
+<span class="c1"># Authentication / Connection Arguments</span>
+<span class="c1">#</span>
+<span class="c1"># You can explicitly set the connection arguments in each lookup. This may be clearer for some use cases</span>
+<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Pass In Connection Arguments Explicitly</span>
+<span class="w">  </span><span class="nt">ansible.builtin.debug</span><span class="p">:</span>
+<span class="w">    </span><span class="nt">msg</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">&gt;-</span>
+<span class="w">      </span><span class="cp">{{</span> <span class="nv">lookup</span><span class="o">(</span><span class="s1">&#39;vmware.vmware_rest.datacenter_moid&#39;</span><span class="o">,</span> <span class="s1">&#39;/my_dc&#39;</span><span class="o">,</span>
+      <span class="nv">vcenter_hostname</span><span class="o">=</span><span class="s2">&quot;vcenter.test&quot;</span><span class="o">,</span>
+      <span class="nv">vcenter_username</span><span class="o">=</span><span class="s2">&quot;administrator@vsphere.local&quot;</span><span class="o">,</span>
+      <span class="nv">vcenter_password</span><span class="o">=</span><span class="s2">&quot;1234&quot;</span><span class="o">)</span> <span class="cp">}}</span>
+
+<span class="c1"># Alternatively, you can add the connection arguments to a dictionary variable, and then pass that variable to the</span>
+<span class="c1"># lookup plugins. This makes the individual lookup plugin calls simpler</span>
+<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Example Playbook</span>
+<span class="w">  </span><span class="nt">hosts</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">all</span>
+<span class="w">  </span><span class="nt">vars</span><span class="p">:</span>
 <span class="w">    </span><span class="nt">connection_args</span><span class="p">:</span>
-<span class="w">        </span><span class="nt">vcenter_hostname</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;vcenter.test&quot;</span>
-<span class="w">        </span><span class="nt">vcenter_username</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;administrator@vsphere.local&quot;</span>
-<span class="w">        </span><span class="nt">vcenter_password</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;1234&quot;</span>
+<span class="w">      </span><span class="nt">vcenter_hostname</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;vcenter.test&quot;</span>
+<span class="w">      </span><span class="nt">vcenter_username</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;administrator@vsphere.local&quot;</span>
+<span class="w">      </span><span class="nt">vcenter_password</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;1234&quot;</span>
+<span class="w">  </span><span class="nt">tasks</span><span class="p">:</span>
+<span class="w">    </span><span class="c1"># Add more tasks or lookups as needed, referencing the same connection_args variable</span>
+<span class="w">    </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Lookup MoID of the object</span>
+<span class="w">      </span><span class="nt">ansible.builtin.debug</span><span class="p">:</span>
+<span class="w">        </span><span class="nt">msg</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">lookup</span><span class="o">(</span><span class="s1">&#39;vmware.vmware_rest.datacenter_moid&#39;</span><span class="o">,</span> <span class="s1">&#39;/my_dc&#39;</span><span class="o">,</span> <span class="o">**</span><span class="nv">connection_args</span><span class="o">)</span> <span class="cp">}}</span><span class="s">&quot;</span>
 
-<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">lookup MoID of the object</span>
-<span class="w">  </span><span class="nt">ansible.builtin.debug</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">msg=&quot;</span><span class="cp">{{</span> <span class="nv">lookup</span><span class="o">(</span><span class="s1">&#39;vmware.vmware_rest.datacenter_moid&#39;</span><span class="o">,</span> <span class="s1">&#39;/my_dc&#39;</span><span class="o">,</span> <span class="o">**</span><span class="nv">connection_args</span><span class="o">)</span> <span class="cp">}}</span><span class="l l-Scalar l-Scalar-Plain">&quot;</span>
+<span class="c1"># Finally, you can also leverage the environment variables associated with each connection arg, and avoid passing</span>
+<span class="c1"># extra args to the lookup plugins</span>
+<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Use a lookup plugin with VMWARE_* environment variables set</span>
+<span class="w">  </span><span class="nt">ansible.builtin.debug</span><span class="p">:</span>
+<span class="w">    </span><span class="nt">msg</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">lookup</span><span class="o">(</span><span class="s1">&#39;vmware.vmware_rest.datacenter_moid&#39;</span><span class="o">,</span> <span class="s1">&#39;/my_dc&#39;</span><span class="o">)</span> <span class="cp">}}</span><span class="s">&quot;</span>
 
-<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">lookup MoID of the object inside the path</span>
-<span class="w">  </span><span class="nt">ansible.builtin.debug</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">msg=&quot;</span><span class="cp">{{</span> <span class="nv">lookup</span><span class="o">(</span><span class="s1">&#39;vmware.vmware_rest.datacenter_moid&#39;</span><span class="o">,</span> <span class="s1">&#39;/my_folder/&#39;</span><span class="o">)</span> <span class="cp">}}</span><span class="l l-Scalar l-Scalar-Plain">&quot;</span>
+<span class="c1">#</span>
+<span class="c1"># Datacenter Search Path Examples</span>
+<span class="c1">#</span>
+<span class="c1"># Datacenters are located at the root of VMWare paths.</span>
+<span class="c1"># The basic path for a datacenter should look like &#39;/&lt;datacenter-name&gt;&#39;</span>
+<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Lookup Datacenter &#39;my_dc&#39;</span>
+<span class="w">  </span><span class="nt">ansible.builtin.debug</span><span class="p">:</span>
+<span class="w">    </span><span class="nt">msg</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">lookup</span><span class="o">(</span><span class="s1">&#39;vmware.vmware_rest.datacenter_moid&#39;</span><span class="o">,</span> <span class="s1">&#39;/my_dc&#39;</span><span class="o">)</span> <span class="cp">}}</span><span class="s">&quot;</span>
+
+<span class="c1"># Usage in Playbooks</span>
+<span class="c1">#</span>
+<span class="c1">#</span>
+<span class="c1"># The lookup plugin can be used to simplify your playbook. Here is an example of how you might use it.</span>
+<span class="c1">#</span>
+<span class="c1"># Without the lookup, this takes two modules which both run on the remote host. This can slow down execution</span>
+<span class="c1"># and adds extra steps to the playbook:</span>
+<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Retrieve details about a datacenter named &#39;my_dc&#39;</span>
+<span class="w">  </span><span class="nt">vmware.vmware_rest.vcenter_datacenter_info</span><span class="p">:</span>
+<span class="w">    </span><span class="nt">names</span><span class="p">:</span>
+<span class="w">      </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">my_dc</span>
+<span class="w">  </span><span class="nt">register</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">my_dc_info</span>
+
+<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Create a VM</span>
+<span class="w">  </span><span class="nt">vmware.vmware_rest.vcenter_vm</span><span class="p">:</span>
+<span class="w">    </span><span class="nt">placement</span><span class="p">:</span>
+<span class="w">      </span><span class="nt">datacenter</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">my_dc_info.value</span><span class="o">[</span><span class="m">0</span><span class="o">]</span><span class="nv">.datacebter</span> <span class="cp">}}</span><span class="s">&quot;</span>
+<span class="w">    </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">test_vm1</span>
+<span class="w">    </span><span class="nt">guest_OS</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">RHEL_7_64</span>
+<span class="w">    </span><span class="nt">hardware_version</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">VMX_11</span>
+<span class="w">    </span><span class="nt">memory</span><span class="p">:</span>
+<span class="w">      </span><span class="nt">size_MiB</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">1024</span>
+<span class="w">    </span><span class="nt">disks</span><span class="p">:</span>
+<span class="w">      </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">type</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">SATA</span>
+<span class="w">        </span><span class="nt">new_vmdk</span><span class="p">:</span>
+<span class="w">          </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">first_disk</span>
+<span class="w">          </span><span class="nt">capacity</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">3200</span>
+
+<span class="c1"># With the lookup, playbooks are shorter, quicker, and more intuitive:</span>
+<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Create a VM</span>
+<span class="w">  </span><span class="nt">vmware.vmware_rest.vcenter_vm</span><span class="p">:</span>
+<span class="w">    </span><span class="nt">placement</span><span class="p">:</span>
+<span class="w">      </span><span class="nt">datacenter</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">lookup</span><span class="o">(</span><span class="s1">&#39;vmware.vmware_rest.datacenter_moid&#39;</span><span class="o">,</span> <span class="s1">&#39;/my_dc&#39;</span><span class="o">)</span> <span class="cp">}}</span><span class="s">&quot;</span>
+<span class="w">    </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">test_vm1</span>
+<span class="w">    </span><span class="nt">guest_OS</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">RHEL_7_64</span>
+<span class="w">    </span><span class="nt">hardware_version</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">VMX_11</span>
+<span class="w">    </span><span class="nt">memory</span><span class="p">:</span>
+<span class="w">      </span><span class="nt">size_MiB</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">1024</span>
+<span class="w">    </span><span class="nt">disks</span><span class="p">:</span>
+<span class="w">      </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">type</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">SATA</span>
+<span class="w">        </span><span class="nt">new_vmdk</span><span class="p">:</span>
+<span class="w">          </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">first_disk</span>
+<span class="w">          </span><span class="nt">capacity</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">3200</span>
 </pre></div>
 </div>
 </section>
diff --git a/home/runner/work/vmware.vmware_rest/vmware.vmware_rest/docsbuild/base/collections/vmware/vmware_rest/datastore_moid_lookup.html b/home/runner/work/vmware.vmware_rest/vmware.vmware_rest/docsbuild/head/collections/vmware/vmware_rest/datastore_moid_lookup.html
index ffb7192..d823e4c 100644
--- a/home/runner/work/vmware.vmware_rest/vmware.vmware_rest/docsbuild/base/collections/vmware/vmware_rest/datastore_moid_lookup.html
+++ b/home/runner/work/vmware.vmware_rest/vmware.vmware_rest/docsbuild/head/collections/vmware/vmware_rest/datastore_moid_lookup.html
@@ -182,7 +182,10 @@ see <a class="reference internal" href="#ansible-collections-vmware-vmware-rest-
 <div class="ansibleOptionAnchor" id="parameter-_terms"></div><p class="ansible-option-title" id="ansible-collections-vmware-vmware-rest-datastore-moid-lookup-parameter-terms"><strong>Terms</strong></p>
 <a class="ansibleOptionLink" href="#parameter-_terms" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span> / <span class="ansible-option-required">required</span></p>
 </div></td>
-<td><div class="ansible-option-cell"><p>Path to query.</p>
+<td><div class="ansible-option-cell"><p>The absolute folder path to the object you would like to lookup.</p>
+<p>Folder paths always start with the datacenter name, and then the object type (host, vm, network, datastore).</p>
+<p>If the object is in a sub folder, the sub folder path should be added after the object type (for example /my_dc/vm/some/sub_folder/vm_name_to_lookup).</p>
+<p>Enter the object or folder names as seen in the VCenter GUI. Do not escape spaces or special characters.</p>
 </div></td>
 </tr>
 </tbody>
@@ -200,6 +203,15 @@ examples: <code class="docutils literal notranslate"><span class="pre">lookup('v
 </thead>
 <tbody>
 <tr class="row-even"><td><div class="ansible-option-cell">
+<div class="ansibleOptionAnchor" id="parameter-object_type"></div><p class="ansible-option-title" id="ansible-collections-vmware-vmware-rest-datastore-moid-lookup-parameter-object-type"><strong>object_type</strong></p>
+<a class="ansibleOptionLink" href="#parameter-object_type" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
+</div></td>
+<td><div class="ansible-option-cell"><p>Should not be set by the user, it is set internally when using a specific lookup plugin.</p>
+<p>Describes the type of object to lookup. Example, cluster, datacenter, datastore, etc.</p>
+<p class="ansible-option-line"><strong class="ansible-option-default-bold">Default:</strong> <code class="ansible-option-default docutils literal notranslate"><span class="pre">&quot;cluster&quot;</span></code></p>
+</div></td>
+</tr>
+<tr class="row-odd"><td><div class="ansible-option-cell">
 <div class="ansibleOptionAnchor" id="parameter-vcenter_hostname"></div><p class="ansible-option-title" id="ansible-collections-vmware-vmware-rest-datastore-moid-lookup-parameter-vcenter-hostname"><strong>vcenter_hostname</strong></p>
 <a class="ansibleOptionLink" href="#parameter-vcenter_hostname" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span> / <span class="ansible-option-required">required</span></p>
 </div></td>
@@ -210,7 +222,7 @@ examples: <code class="docutils literal notranslate"><span class="pre">lookup('v
 </ul>
 </div></td>
 </tr>
-<tr class="row-odd"><td><div class="ansible-option-cell">
+<tr class="row-even"><td><div class="ansible-option-cell">
 <div class="ansibleOptionAnchor" id="parameter-vcenter_password"></div><p class="ansible-option-title" id="ansible-collections-vmware-vmware-rest-datastore-moid-lookup-parameter-vcenter-password"><strong>vcenter_password</strong></p>
 <a class="ansibleOptionLink" href="#parameter-vcenter_password" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span> / <span class="ansible-option-required">required</span></p>
 </div></td>
@@ -221,7 +233,7 @@ examples: <code class="docutils literal notranslate"><span class="pre">lookup('v
 </ul>
 </div></td>
 </tr>
-<tr class="row-even"><td><div class="ansible-option-cell">
+<tr class="row-odd"><td><div class="ansible-option-cell">
 <div class="ansibleOptionAnchor" id="parameter-vcenter_rest_log_file"></div><p class="ansible-option-title" id="ansible-collections-vmware-vmware-rest-datastore-moid-lookup-parameter-vcenter-rest-log-file"><strong>vcenter_rest_log_file</strong></p>
 <a class="ansibleOptionLink" href="#parameter-vcenter_rest_log_file" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
 </div></td>
@@ -234,7 +246,7 @@ examples: <code class="docutils literal notranslate"><span class="pre">lookup('v
 </ul>
 </div></td>
 </tr>
-<tr class="row-odd"><td><div class="ansible-option-cell">
+<tr class="row-even"><td><div class="ansible-option-cell">
 <div class="ansibleOptionAnchor" id="parameter-vcenter_username"></div><p class="ansible-option-title" id="ansible-collections-vmware-vmware-rest-datastore-moid-lookup-parameter-vcenter-username"><strong>vcenter_username</strong></p>
 <a class="ansibleOptionLink" href="#parameter-vcenter_username" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span> / <span class="ansible-option-required">required</span></p>
 </div></td>
@@ -245,7 +257,7 @@ examples: <code class="docutils literal notranslate"><span class="pre">lookup('v
 </ul>
 </div></td>
 </tr>
-<tr class="row-even"><td><div class="ansible-option-cell">
+<tr class="row-odd"><td><div class="ansible-option-cell">
 <div class="ansibleOptionAnchor" id="parameter-vcenter_validate_certs"></div><p class="ansible-option-title" id="ansible-collections-vmware-vmware-rest-datastore-moid-lookup-parameter-vcenter-validate-certs"><strong>vcenter_validate_certs</strong></p>
 <a class="ansibleOptionLink" href="#parameter-vcenter_validate_certs" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
 </div></td>
@@ -271,24 +283,114 @@ examples: <code class="docutils literal notranslate"><span class="pre">lookup('v
 <ul class="simple">
 <li><p>When keyword and positional parameters are used together, positional parameters must be listed before keyword parameters:
 <code class="docutils literal notranslate"><span class="pre">lookup('vmware.vmware_rest.datastore_moid',</span> <span class="pre">term1,</span> <span class="pre">term2,</span> <span class="pre">key1=value1,</span> <span class="pre">key2=value2)</span></code> and <code class="docutils literal notranslate"><span class="pre">query('vmware.vmware_rest.datastore_moid',</span> <span class="pre">term1,</span> <span class="pre">term2,</span> <span class="pre">key1=value1,</span> <span class="pre">key2=value2)</span></code></p></li>
+<li><p>Lookup plugins are run on the ansible controller and are used to lookup information from an external resource. See <a class="reference external" href="https://docs.ansible.com/ansible/latest/plugins/lookup.html#lookup-plugins">https://docs.ansible.com/ansible/latest/plugins/lookup.html#lookup-plugins</a></p></li>
+<li><p>This collection’s plugins allow you to quickly gather VMWare resource identifiers and either store or use them, instead of requiring multiple modules and tasks to do the same thing. See the examples section for a comparison.</p></li>
 </ul>
 </div>
 </section>
 <section id="examples">
 <h2><a class="toc-backref" href="#id6" role="doc-backlink">Examples</a><a class="headerlink" href="#examples" title="Link to this heading"></a></h2>
-<div class="highlight-yaml+jinja notranslate"><div class="highlight"><pre><span></span><span class="c1"># lookup sample</span>
-<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">set connection info</span>
-<span class="w">  </span><span class="nt">ansible.builtin.set_fact</span><span class="p">:</span>
+<div class="highlight-yaml+jinja notranslate"><div class="highlight"><pre><span></span><span class="c1">#</span>
+<span class="c1">#</span>
+<span class="c1"># The examples below assume you have a datacenter named &#39;my_dc&#39; and a datastore named &#39;my_datastore&#39;.</span>
+<span class="c1"># Replace these values as needed for your environment.</span>
+<span class="c1">#</span>
+<span class="c1">#</span>
+
+<span class="c1">#</span>
+<span class="c1"># Authentication / Connection Arguments</span>
+<span class="c1">#</span>
+<span class="c1"># You can explicitly set the connection arguments in each lookup. This may be clearer for some use cases</span>
+<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Pass In Connection Arguments Explicitly</span>
+<span class="w">  </span><span class="nt">ansible.builtin.debug</span><span class="p">:</span>
+<span class="w">    </span><span class="nt">msg</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">&gt;-</span>
+<span class="w">      </span><span class="cp">{{</span> <span class="nv">lookup</span><span class="o">(</span><span class="s1">&#39;vmware.vmware_rest.datastore_moid&#39;</span><span class="o">,</span> <span class="s1">&#39;/my_dc/datastore/my_datastore&#39;</span><span class="o">,</span>
+      <span class="nv">vcenter_hostname</span><span class="o">=</span><span class="s2">&quot;vcenter.test&quot;</span><span class="o">,</span>
+      <span class="nv">vcenter_username</span><span class="o">=</span><span class="s2">&quot;administrator@vsphere.local&quot;</span><span class="o">,</span>
+      <span class="nv">vcenter_password</span><span class="o">=</span><span class="s2">&quot;1234&quot;</span><span class="o">)</span> <span class="cp">}}</span>
+
+<span class="c1"># Alternatively, you can add the connection arguments to a dictionary variable, and then pass that variable to the</span>
+<span class="c1"># lookup plugins. This makes the individual lookup plugin calls simpler</span>
+<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Example Playbook</span>
+<span class="w">  </span><span class="nt">hosts</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">all</span>
+<span class="w">  </span><span class="nt">vars</span><span class="p">:</span>
 <span class="w">    </span><span class="nt">connection_args</span><span class="p">:</span>
-<span class="w">        </span><span class="nt">vcenter_hostname</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;vcenter.test&quot;</span>
-<span class="w">        </span><span class="nt">vcenter_username</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;administrator@vsphere.local&quot;</span>
-<span class="w">        </span><span class="nt">vcenter_password</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;1234&quot;</span>
+<span class="w">      </span><span class="nt">vcenter_hostname</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;vcenter.test&quot;</span>
+<span class="w">      </span><span class="nt">vcenter_username</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;administrator@vsphere.local&quot;</span>
+<span class="w">      </span><span class="nt">vcenter_password</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;1234&quot;</span>
+<span class="w">  </span><span class="nt">tasks</span><span class="p">:</span>
+<span class="w">    </span><span class="c1"># Add more tasks or lookups as needed, referencing the same connection_args variable</span>
+<span class="w">    </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Lookup MoID of the object</span>
+<span class="w">      </span><span class="nt">ansible.builtin.debug</span><span class="p">:</span>
+<span class="w">        </span><span class="nt">msg</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">lookup</span><span class="o">(</span><span class="s1">&#39;vmware.vmware_rest.datastore_moid&#39;</span><span class="o">,</span> <span class="s1">&#39;/my_dc/datastore/my_datastore&#39;</span><span class="o">,</span> <span class="o">**</span><span class="nv">connection_args</span><span class="o">)</span> <span class="cp">}}</span><span class="s">&quot;</span>
 
-<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">lookup MoID of the object</span>
-<span class="w">  </span><span class="nt">ansible.builtin.debug</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">msg=&quot;</span><span class="cp">{{</span> <span class="nv">lookup</span><span class="o">(</span><span class="s1">&#39;vmware.vmware_rest.datastore_moid&#39;</span><span class="o">,</span> <span class="s1">&#39;/my_dc/host/my_cluster/esxi1.test/ro_datastore&#39;</span><span class="o">,</span> <span class="o">**</span><span class="nv">connection_args</span><span class="o">)</span> <span class="cp">}}</span><span class="l l-Scalar l-Scalar-Plain">&quot;</span>
+<span class="c1"># Finally, you can also leverage the environment variables associated with each connection arg, and avoid passing</span>
+<span class="c1"># extra args to the lookup plugins</span>
+<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Use a lookup plugin with VMWARE_* environment variables set</span>
+<span class="w">  </span><span class="nt">ansible.builtin.debug</span><span class="p">:</span>
+<span class="w">    </span><span class="nt">msg</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">lookup</span><span class="o">(</span><span class="s1">&#39;vmware.vmware_rest.datastore_moid&#39;</span><span class="o">,</span> <span class="s1">&#39;/my_dc/datastore/my_datastore&#39;</span><span class="o">)</span> <span class="cp">}}</span><span class="s">&quot;</span>
 
-<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">lookup MoID of the object inside the path</span>
-<span class="w">  </span><span class="nt">ansible.builtin.debug</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">msg=&quot;</span><span class="cp">{{</span> <span class="nv">lookup</span><span class="o">(</span><span class="s1">&#39;vmware.vmware_rest.datastore_moid&#39;</span><span class="o">,</span> <span class="s1">&#39;/my_dc/datastore/&#39;</span><span class="o">)</span> <span class="cp">}}</span><span class="l l-Scalar l-Scalar-Plain">&quot;</span>
+<span class="c1">#</span>
+<span class="c1"># Datastore Search Path Examples</span>
+<span class="c1">#</span>
+<span class="c1"># Datastores are located under the &#39;datastore&#39; folder in a datacenter.</span>
+<span class="c1"

@mikemorency mikemorency force-pushed the mm-feature/update-lookup-docs branch from 98c0d0c to a0ff710 Compare August 6, 2024 14:02
Copy link
Contributor

@mikemorency
Copy link
Collaborator Author

@alinabuzachis or @felixfontein I dont understand this new documentation build step, can one of you assist with debugging steps or let me know what the error is?

@felixfontein
Copy link

@mikemorency the errors indicate that there are quite a few bad references in the collection's docs. There are already quite some errors in the BASE build step (which don't make the build fail, since the main branch is assumed to be building fine), which indicates that the main branch already has some of these errors. (I didn't check whether your PR introduces more / fixes some or not.)

.../content_locallibrary_module.rst:697: WARNING: undefined label: 'ansible_collections.vmware.vmware_rest.content_library_item_module'
.../content_locallibrary_module.rst:699: WARNING: undefined label: 'ansible_collections.vmware.vmware_rest.content_library_item_module'
.../content_locallibrary_module.rst:699: WARNING: undefined label: 'ansible_collections.vmware.vmware_rest.content_library_item_module'
.../content_subscribedlibrary_module.rst:699: WARNING: undefined label: 'ansible_collections.vmware.vmware_rest.content_library_item_module'
.../content_subscribedlibrary_module.rst:701: WARNING: undefined label: 'ansible_collections.vmware.vmware_rest.content_library_item_module'
.../content_subscribedlibrary_module.rst:701: WARNING: undefined label: 'ansible_collections.vmware.vmware_rest.content_library_item_module'

It looks like the docuemtantion of the vmware.vmware_rest.content_locallibrary and vmware.vmware_rest.content_subscribedlibrary modules reference a vmware.vmware_rest.content_library_item module, which does not exist in this collection. (There's an _info module of that name though.)

.../docsite/dev_guide.rst:15: WARNING: 'any' reference target not found: https://github.com/ansible-collections/vmware_rest_code_generator
.../docsite/dev_guide.rst:28: WARNING: 'any' reference target not found: https://tox.readthedocs.io/en/latest/install.html
.../docsite/dev_guide.rst:34: WARNING: 'any' reference target not found: https://github.com/psf/black
.../docsite/dev_guide.rst:56: WARNING: 'any' reference target not found: tests/integration/targets/
.../docsite/dev_guide.rst:63: WARNING: 'any' reference target not found: https://github.com/psf/black
.../docsite/dev_guide.rst:89: WARNING: 'any' reference target not found: /tmp/inventory-vmware_rest

These errors often indicate that someone used single backticks instead of double backticks.

.../vcenter_storage_policies_info_module.rst:125: WARNING: undefined label: 'ansible_collections.vmware.vmware_rest.vcenter_storage_policies_module'
.../vcenter_vm_hardware_disk_module.rst:309: WARNING: undefined label: 'ansible_collections.vmware.vmware_rest.vcenter_storage_policies_module'
.../vcenter_vm_module.rst:2148: WARNING: undefined label: 'ansible_collections.vmware.vmware_rest.vcenter_storage_policies_module'
.../vcenter_vm_power_module.rst:55: WARNING: undefined label: 'ansible_collections.vmware.vmware_rest.vmware_vm_guest_power_module'
.../vcenter_vm_storage_policy_module.rst:489: WARNING: undefined label: 'ansible_collections.vmware.vmware_rest.vcenter_storage_policies_module'

The above reference a vmware.vmware_rest.vcenter_storage_policies module, while only a vmware.vmware_rest.vcenter_storage_policies_info module exists.

Also, the workflow for main is currently broken btw (https://github.com/ansible-collections/vmware.vmware_rest/actions/runs/10266072899).

@mariolenz
Copy link
Collaborator

@mikemorency the errors indicate that there are quite a few bad references in the collection's docs. There are already quite some errors in the BASE build step (which don't make the build fail, since the main branch is assumed to be building fine), which indicates that the main branch already has some of these errors. (I didn't check whether your PR introduces more / fixes some or not.)

I didn't check, either. But I agree that it looks like the main branch itself is broken: #508

@mikemorency
Copy link
Collaborator Author

thank you for the explanation! Those all seem unrelated to this change, so im going to go ahead and fix them on a different pr

@mikemorency mikemorency force-pushed the mm-feature/update-lookup-docs branch from a0ff710 to 3c69266 Compare August 9, 2024 13:31
Copy link
Contributor

Build succeeded (gate pipeline).
https://ansible.softwarefactory-project.io/zuul/buildset/1811d796387a4c3d983cb4cb81d86f31

✔️ ansible-test-cloud-integration-vmware-rest SUCCESS in 10m 05s
✔️ build-ansible-collection SUCCESS in 7m 42s
✔️ ansible-galaxy-importer SUCCESS in 4m 38s

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit 618a19d into ansible-collections:main Aug 9, 2024
12 of 13 checks passed
mikemorency added a commit to mikemorency/vmware.vmware_rest that referenced this pull request Aug 16, 2024
SUMMARY
The lookup plugin documentation needs to be updated. Its missing useful examples, inconsistent, and can be vague. These changes should address those issues.
ISSUE TYPE

Docs Pull Request

COMPONENT NAME
all lookup plugins (plugins/lookup/*)

Reviewed-by: Brian Coca
Reviewed-by: mikemorency
Reviewed-by: Alina Buzachis
(cherry picked from commit 618a19d)
mikemorency added a commit to mikemorency/vmware.vmware_rest that referenced this pull request Aug 19, 2024
SUMMARY
The lookup plugin documentation needs to be updated. Its missing useful examples, inconsistent, and can be vague. These changes should address those issues.
ISSUE TYPE

Docs Pull Request

COMPONENT NAME
all lookup plugins (plugins/lookup/*)

Reviewed-by: Brian Coca
Reviewed-by: mikemorency
Reviewed-by: Alina Buzachis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants