Debian Codegraph @

ansible_collections/vmware/vmware_rest/plugins/modules/content_locallibrary.py

raw
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 # Copyright: (c) 2021, Ansible Project
4 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
5 # template: header.j2
6 # This module is autogenerated using the ansible.content_builder.
7 # See: https://github.com/ansible-community/ansible.content_builder
8
9
10 DOCUMENTATION = r"""
11 module: content_locallibrary
12 short_description: Creates a new local library.
13 description: Creates a new local library.
14 deprecated:
15 removed_in: 5.0.0
16 why: This module has been moved to the L(new vmware.vmware collection,https://forum.ansible.com/t/5880)
17 alternative: Use M(vmware.vmware.local_content_library) instead.
18 options:
19 client_token:
20 description:
21 - 'A unique token generated on the client for each creation request. The token
22 should be a universally unique identifier (UUID), for example: b8a2a2e3-2314-43cd-a871-6ede0f429751.
23 This token can be used to guarantee idempotent creation.'
24 - If not specified creation is not idempotent.
25 type: str
26 creation_time:
27 description:
28 - The date and time when this library was created.
29 - This field is not used for the create operation. It will always be present
30 in the result of the get or list operations. It is not used for the update
31 operation.
32 type: str
33 description:
34 description:
35 - A human-readable description for this library.
36 - This field is optional for the create operation. Leaving it unset during
37 creation will result in an empty string value. It will always be present
38 in the result of a get or list operation. It is optional for the update
39 operation. Leaving it unset during update indicates that the description
40 should be left unchanged.
41 type: str
42 id:
43 description:
44 - An identifier which uniquely identifies this LibraryModel.
45 - This field is not used for the create operation. It will not be present
46 in the result of the get or list operations. It is not used for the update
47 operation.
48 - 'When clients pass a value of this structure as a parameter, the field must
49 be the id of a resource returned by M(vmware.vmware_rest.content_library_info). '
50 type: str
51 last_modified_time:
52 description:
53 - 'The date and time when this library was last updated. '
54 - ' This field is updated automatically when the library properties are changed.
55 This field is not affected by adding, removing, or modifying a library
56 item or its content within the library. Tagging the library or syncing
57 the subscribed library does not alter this field.'
58 - ''
59 - This field is not used for the create operation. It will always be present
60 in the result of the get or list operations. It is not used for the update
61 operation.
62 type: str
63 last_sync_time:
64 description:
65 - 'The date and time when this library was last synchronized. '
66 - ' This field applies only to subscribed libraries. It is updated every time
67 a synchronization is triggered on the library. The value is unset for
68 a local library.'
69 - ''
70 - This field is not used for the create operation. It is optional in the result
71 of the get or list operations. It is not used for the update operation.
72 type: str
73 library_id:
74 description:
75 - Identifier of the local library to delete.
76 - The parameter must be the id of a resource returned by M(vmware.vmware_rest.content_library_info).
77 Required with I(state=['absent', 'present', 'publish'])
78 type: str
79 name:
80 description:
81 - 'The name of the library. '
82 - ' A Library is identified by a human-readable name. Library names cannot
83 be undefined or an empty string. Names do not have to be unique.'
84 - ''
85 - This field must be provided for the create operation. It will always be
86 present in the result of the get or list operations. It is optional for
87 the update operation.
88 type: str
89 optimization_info:
90 description:
91 - Defines various optimizations and optimization parameters applied to this
92 library.
93 - This field is optional for the create operation. It is optional in the result
94 of the get or list operations. It is optional for the update operation.
95 - 'Valid attributes are:'
96 - ' - C(optimize_remote_publishing) (bool): If set to true then library would
97 be optimized for remote publishing. '
98 - ' Turn it on if remote publishing is dominant use case for this library.
99 Remote publishing means here that publisher and subscribers are not the
100 part of the same Vcenter SSO domain. '
101 - ''
102 - ' Any optimizations could be done as result of turning on this optimization
103 during library creation. For example, library content could be stored
104 in different format but optimizations are not limited to just storage
105 format. '
106 - ''
107 - ' Note, that value of this toggle could be set only during creation of the
108 library and you would need to migrate your library in case you need to
109 change this value (optimize the library for different use case).'
110 - ''
111 - This field is optional for the create operation. If not specified for the
112 create, the default is for the library to not be optmized for specific
113 use case. It is not used for the update operation. (['present'])
114 type: dict
115 publish_info:
116 description:
117 - 'Defines how this library is published so that it can be subscribed to by
118 a remote subscribed library. '
119 - ' The PublishInfo defines where and how the metadata for this local library
120 is accessible. A local library is only published publically if PublishInfo.published
121 is true.'
122 - ''
123 - This field is optional for the create and update operations. If not specified
124 during creation, the default is for the library to not be published. If
125 not specified during update, the field is left unchanged.
126 - 'Valid attributes are:'
127 - ' - C(authentication_method) (str): This option indicates how a subscribed
128 library should authenticate to the published library endpoint. ([''present''])'
129 - ' - Accepted values:'
130 - ' - BASIC'
131 - ' - NONE'
132 - ' - C(published) (bool): Whether the local library is published.'
133 - This field is required for the LocalLibrary.create operation. It is optional
134 for the LocalLibrary.update operation, and if unset the value will not
135 be changed. When the existing authentication method is BASIC and the local
136 library is published, the PublishInfo.current-password field is required
137 before turning off publishing. This field will always be present in the
138 results of the LocalLibrary.get operation. (['present'])
139 - ' - C(publish_url) (str): The URL to which the library metadata is published
140 by the Content Library Service. '
141 - ' This value can be used to set the SubscriptionInfo.subscription-url property
142 when creating a subscribed library.'
143 - ''
144 - This field is not used for the create operation. It will always be present
145 in the result of the get or list operations. It is not used for the update
146 operation. (['present'])
147 - ' - C(user_name) (str): The username to require for authentication.'
148 - This field is optional for the LocalLibrary.create and LocalLibrary.update
149 operations. When the authentication method is NONE, the username can be
150 left unset. When the authentication method is BASIC, the username is ignored
151 in the current release. It defaults to "vcsp". It is preferable to leave
152 this unset. If specified, it must be set to "vcsp". (['present'])
153 - ' - C(password) (str): The new password to require for authentication.'
154 - This field is optional for the LocalLibrary.create operation. When the authentication
155 method is NONE, the password can be left unset. When the authentication
156 method is BASIC, the password should be a non-empty string. This field
157 is optional for the LocalLibrary.update operation. Leaving it unset during
158 update indicates that the password is not changed. When the password is
159 changed, the PublishInfo.current-password field is required. This field
160 is not used for the LocalLibrary.get operation. (['present'])
161 - ' - C(current_password) (str): The current password to verify. This field
162 is available starting in vSphere 6.7.'
163 - This field is unused for the LocalLibrary.create operation. This field is
164 optional for the LocalLibrary.update operation. When the existing authentication
165 method is NONE, the current password can be left unset. When the existing
166 authentication method is BASIC, the current password is verified before
167 applying the new PublishInfo.password, turning off authentication, or
168 unpublishing the library. This field is not used for the LocalLibrary.get
169 operation. (['present'])
170 - ' - C(persist_json_enabled) (bool): Whether library and library item metadata
171 are persisted in the storage backing as JSON files. This flag only applies
172 if the local library is published. '
173 - ' Enabling JSON persistence allows you to synchronize a subscribed library
174 manually instead of over HTTP. You copy the local library content and
175 metadata to another storage backing manually and then create a subscribed
176 library referencing the location of the library JSON file in the SubscriptionInfo.subscription-url.
177 When the subscribed library''s storage backing matches the subscription
178 URL, files do not need to be copied to the subscribed library. '
179 - ''
180 - ' For a library backed by a datastore, the library JSON file will be stored
181 at the path contentlib-{library_id}/lib.json on the datastore. '
182 - ''
183 - ' For a library backed by a remote file system, the library JSON file will
184 be stored at {library_id}/lib.json in the remote file system path.'
185 - ''
186 - This field is optional for the create operation. It will always be present
187 in the result of the get or list operations. It is optional for the update
188 operation. (['present'])
189 type: dict
190 security_policy_id:
191 description:
192 - 'Represents the security policy applied to this library. '
193 - ' Setting the field will make the library secure. This field is ignored
194 in update operation if LibraryModel.unset-security-policy-id is set to
195 true.'
196 - ''
197 - This field is optional for the create and update operations. If not set
198 in create operation, the library will be insecure. If not specified in
199 update operation, the field is left unchanged.
200 - 'When clients pass a value of this structure as a parameter, the field must
201 be the id of a resource returned by M(vmware.vmware_rest.content_library_info). '
202 type: str
203 server_guid:
204 description:
205 - The unique identifier of the vCenter server where the library exists.
206 - This field is optional for the create operation. It will always be present
207 in the result of the get or list operations. It is not used for the update
208 operation.
209 - 'When clients pass a value of this structure as a parameter, the field must
210 be the id of a resource returned by M(vmware.vmware_rest.vcenter_cluster_info). '
211 type: str
212 session_timeout:
213 description:
214 - 'Timeout settings for client session. '
215 - 'The maximal number of seconds for the whole operation including connection
216 establishment, request sending and response. '
217 - The default value is 300s.
218 type: float
219 version_added: 2.1.0
220 state:
221 choices:
222 - absent
223 - present
224 - publish
225 default: present
226 description: []
227 type: str
228 storage_backings:
229 description:
230 - 'The list of default storage backings which are available for this library. '
231 - ' A StorageBacking defines a default storage location which can be used
232 to store files for library items in this library. Some library items,
233 for instance, virtual machine template items, support files that may be
234 distributed across various storage backings. One or more item files may
235 or may not be located on the default storage backing. '
236 - ''
237 - ' Multiple default storage locations are not currently supported but may
238 become supported in future releases.'
239 - ''
240 - This field must be provided for the create operation. It will always be
241 present in the result of the get or list operations. It is not used for
242 the update operation.
243 - 'Valid attributes are:'
244 - ' - C(type) (str): This option specifies the type of the StorageBacking.
245 ([''present''])'
246 - ' - Accepted values:'
247 - ' - DATASTORE'
248 - ' - OTHER'
249 - ' - C(datastore_id) (str): Identifier of the datastore used to store the
250 content in the library.'
251 - This field is optional and it is only relevant when the value of StorageBacking.type
252 is DATASTORE.
253 - When clients pass a value of this structure as a parameter, the field must
254 be the id of a resource returned by M(vmware.vmware_rest.vcenter_datastore_info).
255 (['present'])
256 - ' - C(storage_uri) (str): URI identifying the location used to store the
257 content in the library. '
258 - ' The following URI formats are supported: '
259 - ''
260 - ' vSphere 6.5 '
261 - ''
262 - ' - nfs://server/path?version=4 (for vCenter Server Appliance only) -
263 Specifies an NFS Version 4 server.'
264 - ' - nfs://server/path (for vCenter Server Appliance only) - Specifies
265 an NFS Version 3 server. The nfs://server:/path format is also supported.'
266 - ' - smb://server/path - Specifies an SMB server or Windows share.'
267 - ' '
268 - ' vSphere 6.0 Update 1 '
269 - ''
270 - ' - nfs://server:/path (for vCenter Server Appliance only)'
271 - ' - file://unc-server/path (for vCenter Server for Windows only)'
272 - ' - file:///mount/point (for vCenter Server Appliance only) - Local file
273 URIs are supported only when the path is a local mount point for an NFS
274 file system. Use of file URIs is strongly discouraged. Instead, use an
275 NFS URI to specify the remote file system.'
276 - ' '
277 - ' vSphere 6.0 '
278 - ''
279 - ' - nfs://server:/path (for vCenter Server Appliance only)'
280 - ' - file://unc-server/path (for vCenter Server for Windows only)'
281 - ' - file:///path - Local file URIs are supported but strongly discouraged
282 because it may interfere with the performance of vCenter Server.'
283 - ' '
284 - This field is optional and it is only relevant when the value of StorageBacking.type
285 is OTHER. (['present'])
286 elements: dict
287 type: list
288 subscription_info:
289 description:
290 - 'Defines the subscription behavior for this Library. '
291 - ' The SubscriptionInfo defines how this subscribed library synchronizes
292 to a remote source. Setting the value will determine the remote source
293 to which the library synchronizes, and how. Changing the subscription
294 will result in synchronizing to a new source. If the new source differs
295 from the old one, the old library items and data will be lost. Setting
296 SubscriptionInfo.automatic-sync-enabled to false will halt subscription
297 but will not remove existing cached data.'
298 - ''
299 - This field is optional for the create and update operations. If not specified
300 during creation, a default will be created without an active subscription.
301 If not specified during update, the field is left unchanged.
302 - 'Valid attributes are:'
303 - ' - C(authentication_method) (str): Indicate how the subscribed library
304 should authenticate with the published library endpoint. ([''present''])'
305 - ' - Accepted values:'
306 - ' - BASIC'
307 - ' - NONE'
308 - ' - C(automatic_sync_enabled) (bool): Whether the library should participate
309 in automatic library synchronization. In order for automatic synchronization
310 to happen, the global ConfigurationModel.automatic-sync-enabled option
311 must also be true. The subscription is still active even when automatic
312 synchronization is turned off, but synchronization is only activated with
313 an explicit call to SubscribedLibrary.sync or SubscribedItem.sync. In
314 other words, manual synchronization is still available even when automatic
315 synchronization is disabled.'
316 - This field must be provided for the create operation. It will always be
317 present in the result of the get or list operations. It is optional for
318 the update operation. (['present'])
319 - ' - C(on_demand) (bool): Indicates whether a library item''s content will
320 be synchronized only on demand. '
321 - ' If this is set to true, then the library item''s metadata will be synchronized
322 but the item''s content (its files) will not be synchronized. The Content
323 Library Service will synchronize the content upon request only. This can
324 cause the first use of the content to have a noticeable delay. '
325 - ''
326 - ' Items without synchronized content can be forcefully synchronized in advance
327 using the SubscribedItem.sync call with forceSyncContent set to true.
328 Once content has been synchronized, the content can removed with the SubscribedItem.evict
329 call. '
330 - ''
331 - ' If this value is set to false, all content will be synchronized in advance.'
332 - ''
333 - This field must be provided for the create operation. It will always be
334 present in the result of the get or list operations. It is optional for
335 the update operation. (['present'])
336 - ' - C(password) (str): The password to use when authenticating. '
337 - ' The password must be set when using a password-based authentication method;
338 empty strings are not allowed.'
339 - ''
340 - This field is optional for the create operation. It will not be present
341 in the result of the get or list operations. It is optional for the update
342 operation. (['present'])
343 - ' - C(ssl_thumbprint) (str): An optional SHA-1 hash of the SSL certificate
344 for the remote endpoint. '
345 - ' If this value is defined the SSL certificate will be verified by comparing
346 it to the SSL thumbprint. The SSL certificate must verify against the
347 thumbprint. When specified, the standard certificate chain validation
348 behavior is not used. The certificate chain is validated normally if this
349 value is unset. The specified sslThumbprint will not be checked for SSL
350 certificate validation if {SubscriptionInfo#sslCertificate} is also set.'
351 - ''
352 - This field is optional for the create operation. It will not be present
353 in the result of the get or list operations. It is optional for the update
354 operation. (['present'])
355 - ' - C(subscription_url) (str): The URL of the endpoint where the metadata
356 for the remotely published library is being served. '
357 - ' This URL can be the PublishInfo.publish-url of the published library (for
358 example, https://server/path/lib.json). '
359 - ''
360 - ' If the source content comes from a published library with PublishInfo.persist-json-enabled,
361 the subscription URL can be a URL pointing to the library JSON file on
362 a datastore or remote file system. The supported formats are: '
363 - ''
364 - ' vSphere 6.5 '
365 - ''
366 - ' - ds:///vmfs/volumes/{uuid}/mylibrary/lib.json (for datastore)'
367 - ' - nfs://server/path/mylibrary/lib.json (for NFSv3 server on vCenter
368 Server Appliance)'
369 - ' - nfs://server/path/mylibrary/lib.json?version=4 (for NFSv4 server on
370 vCenter Server Appliance) '
371 - ' - smb://server/path/mylibrary/lib.json (for SMB server)'
372 - ' '
373 - ' vSphere 6.0 '
374 - ''
375 - ' - file://server/mylibrary/lib.json (for UNC server on vCenter Server
376 for Windows)'
377 - ' - file:///path/mylibrary/lib.json (for local file system)'
378 - ' '
379 - ' When you specify a DS subscription URL, the datastore must be on the same
380 vCenter Server as the subscribed library. When you specify an NFS or SMB
381 subscription URL, the StorageBacking.storage-uri of the subscribed library
382 must be on the same remote file server and should share a common parent
383 path with the subscription URL.'
384 - ''
385 - This field must be provided for the create operation. It will always be
386 present in the result of the get or list operations. It is optional for
387 the update operation. (['present'])
388 - ' - C(user_name) (str): The username to use when authenticating. '
389 - ' The username must be set when using a password-based authentication method.
390 Empty strings are allowed for usernames.'
391 - ''
392 - This field is optional for the create operation. It is optional in the result
393 of the get or list operations. It is optional for the update operation.
394 (['present'])
395 - ' - C(source_info) (dict): Information about the source published library.
396 This field will be set for a subscribed library which is associated with
397 a subscription of the published library.'
398 - This field is optional for the create operation. It is optional in the result
399 of the get or list operations. It is optional for the update operation.
400 (['present'])
401 - ' - Accepted keys:'
402 - ' - source_library (string): Identifier of the published library.'
403 - This field must be provided for the create operation. It will always be
404 present in the result of the get or list operations. It is optional for
405 the update operation.
406 - 'When clients pass a value of this structure as a parameter, the field must
407 be the id of a resource returned by M(vmware.vmware_rest.content_library_info). '
408 - ' - subscription (string): Identifier of the subscription associated
409 with the subscribed library.'
410 - This field must be provided for the create operation. It will always be
411 present in the result of the get or list operations. It is optional for
412 the update operation.
413 - 'When clients pass a value of this structure as a parameter, the field must
414 be the id of a resource returned by M(vmware.vmware_rest.content_library_subscriptions_info). '
415 type: dict
416 subscriptions:
417 description:
418 - The list of subscriptions to publish this library to.
419 - 'Valid attributes are:'
420 - ' - C(subscription) (str): Identifier of the subscription associated with
421 the subscribed library.'
422 - When clients pass a value of this structure as a parameter, the field must
423 be the id of a resource returned by M(vmware.vmware_rest.content_library_subscriptions_info).
424 (['publish'])
425 - ' This key is required with [''publish''].'
426 elements: dict
427 type: list
428 type:
429 choices:
430 - LOCAL
431 - SUBSCRIBED
432 description:
433 - 'The I(library_type) enumerated type defines the type of a LibraryModel. '
434 - ' The type of a library can be used to determine which additional services
435 can be performed with a library.'
436 type: str
437 unset_security_policy_id:
438 description:
439 - 'This represents the intent of the change to LibraryModel.security-policy-id
440 in update operation. '
441 - ' If this field is set to true, any security policy applied to the library
442 will be removed. If this field is set to false, any security policy applied
443 to library will be changed to the value specified in LibraryModel.security-policy-id,
444 if any.'
445 - ''
446 - This field is optional for the update operation. If unset, any existing
447 security policy will be changed to the value specified in LibraryModel.security-policy-id,
448 if any.
449 type: bool
450 vcenter_hostname:
451 description:
452 - The hostname or IP address of the vSphere vCenter
453 - If the value is not specified in the task, the value of environment variable
454 C(VMWARE_HOST) will be used instead.
455 required: true
456 type: str
457 vcenter_password:
458 description:
459 - The vSphere vCenter password
460 - If the value is not specified in the task, the value of environment variable
461 C(VMWARE_PASSWORD) will be used instead.
462 required: true
463 type: str
464 vcenter_rest_log_file:
465 description:
466 - 'You can use this optional parameter to set the location of a log file. '
467 - 'This file will be used to record the HTTP REST interaction. '
468 - 'The file will be stored on the host that runs the module. '
469 - 'If the value is not specified in the task, the value of '
470 - environment variable C(VMWARE_REST_LOG_FILE) will be used instead.
471 type: str
472 vcenter_username:
473 description:
474 - The vSphere vCenter username
475 - If the value is not specified in the task, the value of environment variable
476 C(VMWARE_USER) will be used instead.
477 required: true
478 type: str
479 vcenter_validate_certs:
480 default: true
481 description:
482 - Allows connection when SSL certificates are not valid. Set to C(false) when
483 certificates are not trusted.
484 - If the value is not specified in the task, the value of environment variable
485 C(VMWARE_VALIDATE_CERTS) will be used instead.
486 type: bool
487 version:
488 description:
489 - 'A version number which is updated on metadata changes. This value allows
490 clients to detect concurrent updates and prevent accidental clobbering
491 of data. '
492 - ' This value represents a number which is incremented every time library
493 properties, such as name or description, are changed. It is not incremented
494 by changes to a library item within the library, including adding or removing
495 items. It is also not affected by tagging the library.'
496 - ''
497 - This field is not used for the create operation. It will always be present
498 in the result of a get or list operation. It is optional for the update
499 operation. Leaving it unset during update indicates that you do not need
500 to detect concurrent updates.
501 type: str
502 author:
503 - Ansible Cloud Team (@ansible-collections)
504 version_added: 2.0.0
505 requirements:
506 - vSphere 7.0.3 or greater
507 - python >= 3.6
508 - aiohttp
509 notes:
510 - Tested on vSphere 7.0.3
511 """
512
513 EXAMPLES = r"""
514 - name: Create a content library pointing on a NFS share
515 vmware.vmware_rest.content_locallibrary:
516 name: my_library_on_nfs
517 description: automated
518 publish_info:
519 published: true
520 authentication_method: NONE
521 storage_backings:
522 - storage_uri: nfs://datastore.test/srv/share/content-library
523 type: OTHER
524 state: present
525 register: nfs_lib
526
527 - name: Create some more content libraries
528 vmware.vmware_rest.content_locallibrary:
529 name: my_library_on_nfs_{{ item }}
530 description: automated
531 publish_info:
532 published: true
533 authentication_method: NONE
534 storage_backings:
535 - storage_uri: nfs://datastore.test/srv/share/content-library
536 type: OTHER
537 state: present
538 with_sequence: 0-10
539
540 - name: Create a new local content library
541 vmware.vmware_rest.content_locallibrary:
542 name: local_library_001
543 description: automated
544 publish_info:
545 published: true
546 authentication_method: NONE
547 storage_backings:
548 - datastore_id: "{{ lookup('vmware.vmware_rest.datastore_moid', '/my_dc/datastore/rw_datastore') }}"
549 type: DATASTORE
550 state: present
551 register: ds_lib
552
553 - name: Create a content library based on a DataStore
554 vmware.vmware_rest.content_locallibrary:
555 name: my_library_on_datastore
556 description: automated
557 publish_info:
558 published: true
559 authentication_method: NONE
560 storage_backings:
561 - datastore_id: "{{ lookup('vmware.vmware_rest.datastore_moid', '/my_dc/datastore/local') }}"
562 type: DATASTORE
563 state: present
564 register: nfs_lib
565 """
566 RETURN = r"""
567 # content generated by the update_return_section callback# task: Delete all the local libraries
568 msg:
569 description: Delete all the local libraries
570 returned: On success
571 sample: All items completed
572 type: str
573 results:
574 description: Delete all the local libraries
575 returned: On success
576 sample:
577 - _ansible_item_label:
578 creation_time: '2022-11-23T20:02:22.940Z'
579 description: automated
580 id: a66d5c73-57f8-4a3a-9361-292a55f68516
581 last_modified_time: '2022-11-23T20:02:22.940Z'
582 name: my_library_on_nfs
583 publish_info:
584 authentication_method: NONE
585 persist_json_enabled: 0
586 publish_url: https://vcenter.test:443/cls/vcsp/lib/a66d5c73-57f8-4a3a-9361-292a55f68516/lib.json
587 published: 1
588 user_name: vcsp
589 server_guid: 52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5
590 storage_backings:
591 - storage_uri: nfs://datastore.test/srv/share/content-library
592 type: OTHER
593 type: LOCAL
594 version: '2'
595 _ansible_no_log: null
596 ansible_loop_var: item
597 changed: 1
598 failed: 0
599 invocation:
600 module_args:
601 client_token: null
602 creation_time: null
603 description: null
604 id: null
605 last_modified_time: null
606 last_sync_time: null
607 library_id: a66d5c73-57f8-4a3a-9361-292a55f68516
608 name: null
609 optimization_info: null
610 publish_info: null
611 server_guid: null
612 session_timeout: null
613 state: absent
614 storage_backings: null
615 subscription_info: null
616 subscriptions: null
617 type: null
618 vcenter_hostname: vcenter.test
619 vcenter_password: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
620 vcenter_rest_log_file: /tmp/vmware_rest.log
621 vcenter_username: [email protected]
622 vcenter_validate_certs: 0
623 version: null
624 item:
625 creation_time: '2022-11-23T20:02:22.940Z'
626 description: automated
627 id: a66d5c73-57f8-4a3a-9361-292a55f68516
628 last_modified_time: '2022-11-23T20:02:22.940Z'
629 name: my_library_on_nfs
630 publish_info:
631 authentication_method: NONE
632 persist_json_enabled: 0
633 publish_url: https://vcenter.test:443/cls/vcsp/lib/a66d5c73-57f8-4a3a-9361-292a55f68516/lib.json
634 published: 1
635 user_name: vcsp
636 server_guid: 52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5
637 storage_backings:
638 - storage_uri: nfs://datastore.test/srv/share/content-library
639 type: OTHER
640 type: LOCAL
641 version: '2'
642 value: {}
643 - _ansible_item_label:
644 creation_time: '2022-11-23T20:02:25.134Z'
645 description: automated
646 id: 3393956a-43ed-4e7f-bd96-eb39bd604445
647 last_modified_time: '2022-11-23T20:02:25.134Z'
648 name: my_library_on_nfs_0
649 publish_info:
650 authentication_method: NONE
651 persist_json_enabled: 0
652 publish_url: https://vcenter.test:443/cls/vcsp/lib/3393956a-43ed-4e7f-bd96-eb39bd604445/lib.json
653 published: 1
654 user_name: vcsp
655 server_guid: 52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5
656 storage_backings:
657 - storage_uri: nfs://datastore.test/srv/share/content-library
658 type: OTHER
659 type: LOCAL
660 version: '2'
661 _ansible_no_log: null
662 ansible_loop_var: item
663 changed: 1
664 failed: 0
665 invocation:
666 module_args:
667 client_token: null
668 creation_time: null
669 description: null
670 id: null
671 last_modified_time: null
672 last_sync_time: null
673 library_id: 3393956a-43ed-4e7f-bd96-eb39bd604445
674 name: null
675 optimization_info: null
676 publish_info: null
677 server_guid: null
678 session_timeout: null
679 state: absent
680 storage_backings: null
681 subscription_info: null
682 subscriptions: null
683 type: null
684 vcenter_hostname: vcenter.test
685 vcenter_password: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
686 vcenter_rest_log_file: /tmp/vmware_rest.log
687 vcenter_username: [email protected]
688 vcenter_validate_certs: 0
689 version: null
690 item:
691 creation_time: '2022-11-23T20:02:25.134Z'
692 description: automated
693 id: 3393956a-43ed-4e7f-bd96-eb39bd604445
694 last_modified_time: '2022-11-23T20:02:25.134Z'
695 name: my_library_on_nfs_0
696 publish_info:
697 authentication_method: NONE
698 persist_json_enabled: 0
699 publish_url: https://vcenter.test:443/cls/vcsp/lib/3393956a-43ed-4e7f-bd96-eb39bd604445/lib.json
700 published: 1
701 user_name: vcsp
702 server_guid: 52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5
703 storage_backings:
704 - storage_uri: nfs://datastore.test/srv/share/content-library
705 type: OTHER
706 type: LOCAL
707 version: '2'
708 value: {}
709 - _ansible_item_label:
710 creation_time: '2022-11-23T20:02:26.342Z'
711 description: automated
712 id: 87f66f86-c046-45a7-9563-d59ea220babf
713 last_modified_time: '2022-11-23T20:02:26.342Z'
714 name: my_library_on_nfs_1
715 publish_info:
716 authentication_method: NONE
717 persist_json_enabled: 0
718 publish_url: https://vcenter.test:443/cls/vcsp/lib/87f66f86-c046-45a7-9563-d59ea220babf/lib.json
719 published: 1
720 user_name: vcsp
721 server_guid: 52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5
722 storage_backings:
723 - storage_uri: nfs://datastore.test/srv/share/content-library
724 type: OTHER
725 type: LOCAL
726 version: '2'
727 _ansible_no_log: null
728 ansible_loop_var: item
729 changed: 1
730 failed: 0
731 invocation:
732 module_args:
733 client_token: null
734 creation_time: null
735 description: null
736 id: null
737 last_modified_time: null
738 last_sync_time: null
739 library_id: 87f66f86-c046-45a7-9563-d59ea220babf
740 name: null
741 optimization_info: null
742 publish_info: null
743 server_guid: null
744 session_timeout: null
745 state: absent
746 storage_backings: null
747 subscription_info: null
748 subscriptions: null
749 type: null
750 vcenter_hostname: vcenter.test
751 vcenter_password: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
752 vcenter_rest_log_file: /tmp/vmware_rest.log
753 vcenter_username: [email protected]
754 vcenter_validate_certs: 0
755 version: null
756 item:
757 creation_time: '2022-11-23T20:02:26.342Z'
758 description: automated
759 id: 87f66f86-c046-45a7-9563-d59ea220babf
760 last_modified_time: '2022-11-23T20:02:26.342Z'
761 name: my_library_on_nfs_1
762 publish_info:
763 authentication_method: NONE
764 persist_json_enabled: 0
765 publish_url: https://vcenter.test:443/cls/vcsp/lib/87f66f86-c046-45a7-9563-d59ea220babf/lib.json
766 published: 1
767 user_name: vcsp
768 server_guid: 52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5
769 storage_backings:
770 - storage_uri: nfs://datastore.test/srv/share/content-library
771 type: OTHER
772 type: LOCAL
773 version: '2'
774 value: {}
775 - _ansible_item_label:
776 creation_time: '2022-11-23T20:02:27.504Z'
777 description: automated
778 id: f6c590c4-ae6d-4ad0-9362-378196e98a3c
779 last_modified_time: '2022-11-23T20:02:27.504Z'
780 name: my_library_on_nfs_2
781 publish_info:
782 authentication_method: NONE
783 persist_json_enabled: 0
784 publish_url: https://vcenter.test:443/cls/vcsp/lib/f6c590c4-ae6d-4ad0-9362-378196e98a3c/lib.json
785 published: 1
786 user_name: vcsp
787 server_guid: 52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5
788 storage_backings:
789 - storage_uri: nfs://datastore.test/srv/share/content-library
790 type: OTHER
791 type: LOCAL
792 version: '2'
793 _ansible_no_log: null
794 ansible_loop_var: item
795 changed: 1
796 failed: 0
797 invocation:
798 module_args:
799 client_token: null
800 creation_time: null
801 description: null
802 id: null
803 last_modified_time: null
804 last_sync_time: null
805 library_id: f6c590c4-ae6d-4ad0-9362-378196e98a3c
806 name: null
807 optimization_info: null
808 publish_info: null
809 server_guid: null
810 session_timeout: null
811 state: absent
812 storage_backings: null
813 subscription_info: null
814 subscriptions: null
815 type: null
816 vcenter_hostname: vcenter.test
817 vcenter_password: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
818 vcenter_rest_log_file: /tmp/vmware_rest.log
819 vcenter_username: [email protected]
820 vcenter_validate_certs: 0
821 version: null
822 item:
823 creation_time: '2022-11-23T20:02:27.504Z'
824 description: automated
825 id: f6c590c4-ae6d-4ad0-9362-378196e98a3c
826 last_modified_time: '2022-11-23T20:02:27.504Z'
827 name: my_library_on_nfs_2
828 publish_info:
829 authentication_method: NONE
830 persist_json_enabled: 0
831 publish_url: https://vcenter.test:443/cls/vcsp/lib/f6c590c4-ae6d-4ad0-9362-378196e98a3c/lib.json
832 published: 1
833 user_name: vcsp
834 server_guid: 52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5
835 storage_backings:
836 - storage_uri: nfs://datastore.test/srv/share/content-library
837 type: OTHER
838 type: LOCAL
839 version: '2'
840 value: {}
841 - _ansible_item_label:
842 creation_time: '2022-11-23T20:02:28.821Z'
843 description: automated
844 id: e8917499-2a4c-4b70-b39b-ae0caaef89c3
845 last_modified_time: '2022-11-23T20:02:28.821Z'
846 name: my_library_on_nfs_3
847 publish_info:
848 authentication_method: NONE
849 persist_json_enabled: 0
850 publish_url: https://vcenter.test:443/cls/vcsp/lib/e8917499-2a4c-4b70-b39b-ae0caaef89c3/lib.json
851 published: 1
852 user_name: vcsp
853 server_guid: 52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5
854 storage_backings:
855 - storage_uri: nfs://datastore.test/srv/share/content-library
856 type: OTHER
857 type: LOCAL
858 version: '2'
859 _ansible_no_log: null
860 ansible_loop_var: item
861 changed: 1
862 failed: 0
863 invocation:
864 module_args:
865 client_token: null
866 creation_time: null
867 description: null
868 id: null
869 last_modified_time: null
870 last_sync_time: null
871 library_id: e8917499-2a4c-4b70-b39b-ae0caaef89c3
872 name: null
873 optimization_info: null
874 publish_info: null
875 server_guid: null
876 session_timeout: null
877 state: absent
878 storage_backings: null
879 subscription_info: null
880 subscriptions: null
881 type: null
882 vcenter_hostname: vcenter.test
883 vcenter_password: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
884 vcenter_rest_log_file: /tmp/vmware_rest.log
885 vcenter_username: [email protected]
886 vcenter_validate_certs: 0
887 version: null
888 item:
889 creation_time: '2022-11-23T20:02:28.821Z'
890 description: automated
891 id: e8917499-2a4c-4b70-b39b-ae0caaef89c3
892 last_modified_time: '2022-11-23T20:02:28.821Z'
893 name: my_library_on_nfs_3
894 publish_info:
895 authentication_method: NONE
896 persist_json_enabled: 0
897 publish_url: https://vcenter.test:443/cls/vcsp/lib/e8917499-2a4c-4b70-b39b-ae0caaef89c3/lib.json
898 published: 1
899 user_name: vcsp
900 server_guid: 52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5
901 storage_backings:
902 - storage_uri: nfs://datastore.test/srv/share/content-library
903 type: OTHER
904 type: LOCAL
905 version: '2'
906 value: {}
907 - _ansible_item_label:
908 creation_time: '2022-11-23T20:02:30.085Z'
909 description: automated
910 id: 630ebdfe-8913-45d3-aaa8-9c2fdecbb76b
911 last_modified_time: '2022-11-23T20:02:30.085Z'
912 name: my_library_on_nfs_4
913 publish_info:
914 authentication_method: NONE
915 persist_json_enabled: 0
916 publish_url: https://vcenter.test:443/cls/vcsp/lib/630ebdfe-8913-45d3-aaa8-9c2fdecbb76b/lib.json
917 published: 1
918 user_name: vcsp
919 server_guid: 52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5
920 storage_backings:
921 - storage_uri: nfs://datastore.test/srv/share/content-library
922 type: OTHER
923 type: LOCAL
924 version: '2'
925 _ansible_no_log: null
926 ansible_loop_var: item
927 changed: 1
928 failed: 0
929 invocation:
930 module_args:
931 client_token: null
932 creation_time: null
933 description: null
934 id: null
935 last_modified_time: null
936 last_sync_time: null
937 library_id: 630ebdfe-8913-45d3-aaa8-9c2fdecbb76b
938 name: null
939 optimization_info: null
940 publish_info: null
941 server_guid: null
942 session_timeout: null
943 state: absent
944 storage_backings: null
945 subscription_info: null
946 subscriptions: null
947 type: null
948 vcenter_hostname: vcenter.test
949 vcenter_password: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
950 vcenter_rest_log_file: /tmp/vmware_rest.log
951 vcenter_username: [email protected]
952 vcenter_validate_certs: 0
953 version: null
954 item:
955 creation_time: '2022-11-23T20:02:30.085Z'
956 description: automated
957 id: 630ebdfe-8913-45d3-aaa8-9c2fdecbb76b
958 last_modified_time: '2022-11-23T20:02:30.085Z'
959 name: my_library_on_nfs_4
960 publish_info:
961 authentication_method: NONE
962 persist_json_enabled: 0
963 publish_url: https://vcenter.test:443/cls/vcsp/lib/630ebdfe-8913-45d3-aaa8-9c2fdecbb76b/lib.json
964 published: 1
965 user_name: vcsp
966 server_guid: 52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5
967 storage_backings:
968 - storage_uri: nfs://datastore.test/srv/share/content-library
969 type: OTHER
970 type: LOCAL
971 version: '2'
972 value: {}
973 - _ansible_item_label:
974 creation_time: '2022-11-23T20:02:31.482Z'
975 description: automated
976 id: a046e2e5-bd55-4d04-9443-750a2ab35a6d
977 last_modified_time: '2022-11-23T20:02:31.482Z'
978 name: my_library_on_nfs_5
979 publish_info:
980 authentication_method: NONE
981 persist_json_enabled: 0
982 publish_url: https://vcenter.test:443/cls/vcsp/lib/a046e2e5-bd55-4d04-9443-750a2ab35a6d/lib.json
983 published: 1
984 user_name: vcsp
985 server_guid: 52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5
986 storage_backings:
987 - storage_uri: nfs://datastore.test/srv/share/content-library
988 type: OTHER
989 type: LOCAL
990 version: '2'
991 _ansible_no_log: null
992 ansible_loop_var: item
993 changed: 1
994 failed: 0
995 invocation:
996 module_args:
997 client_token: null
998 creation_time: null
999 description: null
1000 id: null
1001 last_modified_time: null
1002 last_sync_time: null
1003 library_id: a046e2e5-bd55-4d04-9443-750a2ab35a6d
1004 name: null
1005 optimization_info: null
1006 publish_info: null
1007 server_guid: null
1008 session_timeout: null
1009 state: absent
1010 storage_backings: null
1011 subscription_info: null
1012 subscriptions: null
1013 type: null
1014 vcenter_hostname: vcenter.test
1015 vcenter_password: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
1016 vcenter_rest_log_file: /tmp/vmware_rest.log
1017 vcenter_username: [email protected]
1018 vcenter_validate_certs: 0
1019 version: null
1020 item:
1021 creation_time: '2022-11-23T20:02:31.482Z'
1022 description: automated
1023 id: a046e2e5-bd55-4d04-9443-750a2ab35a6d
1024 last_modified_time: '2022-11-23T20:02:31.482Z'
1025 name: my_library_on_nfs_5
1026 publish_info:
1027 authentication_method: NONE
1028 persist_json_enabled: 0
1029 publish_url: https://vcenter.test:443/cls/vcsp/lib/a046e2e5-bd55-4d04-9443-750a2ab35a6d/lib.json
1030 published: 1
1031 user_name: vcsp
1032 server_guid: 52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5
1033 storage_backings:
1034 - storage_uri: nfs://datastore.test/srv/share/content-library
1035 type: OTHER
1036 type: LOCAL
1037 version: '2'
1038 value: {}
1039 - _ansible_item_label:
1040 creation_time: '2022-11-23T20:02:32.846Z'
1041 description: automated
1042 id: b94383b1-7877-4dbd-8c33-51abc39451ff
1043 last_modified_time: '2022-11-23T20:02:32.846Z'
1044 name: my_library_on_nfs_6
1045 publish_info:
1046 authentication_method: NONE
1047 persist_json_enabled: 0
1048 publish_url: https://vcenter.test:443/cls/vcsp/lib/b94383b1-7877-4dbd-8c33-51abc39451ff/lib.json
1049 published: 1
1050 user_name: vcsp
1051 server_guid: 52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5
1052 storage_backings:
1053 - storage_uri: nfs://datastore.test/srv/share/content-library
1054 type: OTHER
1055 type: LOCAL
1056 version: '2'
1057 _ansible_no_log: null
1058 ansible_loop_var: item
1059 changed: 1
1060 failed: 0
1061 invocation:
1062 module_args:
1063 client_token: null
1064 creation_time: null
1065 description: null
1066 id: null
1067 last_modified_time: null
1068 last_sync_time: null
1069 library_id: b94383b1-7877-4dbd-8c33-51abc39451ff
1070 name: null
1071 optimization_info: null
1072 publish_info: null
1073 server_guid: null
1074 session_timeout: null
1075 state: absent
1076 storage_backings: null
1077 subscription_info: null
1078 subscriptions: null
1079 type: null
1080 vcenter_hostname: vcenter.test
1081 vcenter_password: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
1082 vcenter_rest_log_file: /tmp/vmware_rest.log
1083 vcenter_username: [email protected]
1084 vcenter_validate_certs: 0
1085 version: null
1086 item:
1087 creation_time: '2022-11-23T20:02:32.846Z'
1088 description: automated
1089 id: b94383b1-7877-4dbd-8c33-51abc39451ff
1090 last_modified_time: '2022-11-23T20:02:32.846Z'
1091 name: my_library_on_nfs_6
1092 publish_info:
1093 authentication_method: NONE
1094 persist_json_enabled: 0
1095 publish_url: https://vcenter.test:443/cls/vcsp/lib/b94383b1-7877-4dbd-8c33-51abc39451ff/lib.json
1096 published: 1
1097 user_name: vcsp
1098 server_guid: 52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5
1099 storage_backings:
1100 - storage_uri: nfs://datastore.test/srv/share/content-library
1101 type: OTHER
1102 type: LOCAL
1103 version: '2'
1104 value: {}
1105 - _ansible_item_label:
1106 creation_time: '2022-11-23T20:02:34.218Z'
1107 description: automated
1108 id: 8e3efb68-cb84-4ce0-a65a-6c94cc6e6e00
1109 last_modified_time: '2022-11-23T20:02:34.218Z'
1110 name: my_library_on_nfs_7
1111 publish_info:
1112 authentication_method: NONE
1113 persist_json_enabled: 0
1114 publish_url: https://vcenter.test:443/cls/vcsp/lib/8e3efb68-cb84-4ce0-a65a-6c94cc6e6e00/lib.json
1115 published: 1
1116 user_name: vcsp
1117 server_guid: 52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5
1118 storage_backings:
1119 - storage_uri: nfs://datastore.test/srv/share/content-library
1120 type: OTHER
1121 type: LOCAL
1122 version: '2'
1123 _ansible_no_log: null
1124 ansible_loop_var: item
1125 changed: 1
1126 failed: 0
1127 invocation:
1128 module_args:
1129 client_token: null
1130 creation_time: null
1131 description: null
1132 id: null
1133 last_modified_time: null
1134 last_sync_time: null
1135 library_id: 8e3efb68-cb84-4ce0-a65a-6c94cc6e6e00
1136 name: null
1137 optimization_info: null
1138 publish_info: null
1139 server_guid: null
1140 session_timeout: null
1141 state: absent
1142 storage_backings: null
1143 subscription_info: null
1144 subscriptions: null
1145 type: null
1146 vcenter_hostname: vcenter.test
1147 vcenter_password: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
1148 vcenter_rest_log_file: /tmp/vmware_rest.log
1149 vcenter_username: [email protected]
1150 vcenter_validate_certs: 0
1151 version: null
1152 item:
1153 creation_time: '2022-11-23T20:02:34.218Z'
1154 description: automated
1155 id: 8e3efb68-cb84-4ce0-a65a-6c94cc6e6e00
1156 last_modified_time: '2022-11-23T20:02:34.218Z'
1157 name: my_library_on_nfs_7
1158 publish_info:
1159 authentication_method: NONE
1160 persist_json_enabled: 0
1161 publish_url: https://vcenter.test:443/cls/vcsp/lib/8e3efb68-cb84-4ce0-a65a-6c94cc6e6e00/lib.json
1162 published: 1
1163 user_name: vcsp
1164 server_guid: 52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5
1165 storage_backings:
1166 - storage_uri: nfs://datastore.test/srv/share/content-library
1167 type: OTHER
1168 type: LOCAL
1169 version: '2'
1170 value: {}
1171 - _ansible_item_label:
1172 creation_time: '2022-11-23T20:02:35.922Z'
1173 description: automated
1174 id: 0b12c0b3-6c6d-448d-9033-e054a70183e7
1175 last_modified_time: '2022-11-23T20:02:35.922Z'
1176 name: my_library_on_nfs_8
1177 publish_info:
1178 authentication_method: NONE
1179 persist_json_enabled: 0
1180 publish_url: https://vcenter.test:443/cls/vcsp/lib/0b12c0b3-6c6d-448d-9033-e054a70183e7/lib.json
1181 published: 1
1182 user_name: vcsp
1183 server_guid: 52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5
1184 storage_backings:
1185 - storage_uri: nfs://datastore.test/srv/share/content-library
1186 type: OTHER
1187 type: LOCAL
1188 version: '2'
1189 _ansible_no_log: null
1190 ansible_loop_var: item
1191 changed: 1
1192 failed: 0
1193 invocation:
1194 module_args:
1195 client_token: null
1196 creation_time: null
1197 description: null
1198 id: null
1199 last_modified_time: null
1200 last_sync_time: null
1201 library_id: 0b12c0b3-6c6d-448d-9033-e054a70183e7
1202 name: null
1203 optimization_info: null
1204 publish_info: null
1205 server_guid: null
1206 session_timeout: null
1207 state: absent
1208 storage_backings: null
1209 subscription_info: null
1210 subscriptions: null
1211 type: null
1212 vcenter_hostname: vcenter.test
1213 vcenter_password: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
1214 vcenter_rest_log_file: /tmp/vmware_rest.log
1215 vcenter_username: [email protected]
1216 vcenter_validate_certs: 0
1217 version: null
1218 item:
1219 creation_time: '2022-11-23T20:02:35.922Z'
1220 description: automated
1221 id: 0b12c0b3-6c6d-448d-9033-e054a70183e7
1222 last_modified_time: '2022-11-23T20:02:35.922Z'
1223 name: my_library_on_nfs_8
1224 publish_info:
1225 authentication_method: NONE
1226 persist_json_enabled: 0
1227 publish_url: https://vcenter.test:443/cls/vcsp/lib/0b12c0b3-6c6d-448d-9033-e054a70183e7/lib.json
1228 published: 1
1229 user_name: vcsp
1230 server_guid: 52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5
1231 storage_backings:
1232 - storage_uri: nfs://datastore.test/srv/share/content-library
1233 type: OTHER
1234 type: LOCAL
1235 version: '2'
1236 value: {}
1237 - _ansible_item_label:
1238 creation_time: '2022-11-23T20:02:37.796Z'
1239 description: automated
1240 id: 46454797-bbe0-415a-9fe9-3cf2f74a14db
1241 last_modified_time: '2022-11-23T20:02:37.796Z'
1242 name: my_library_on_nfs_9
1243 publish_info:
1244 authentication_method: NONE
1245 persist_json_enabled: 0
1246 publish_url: https://vcenter.test:443/cls/vcsp/lib/46454797-bbe0-415a-9fe9-3cf2f74a14db/lib.json
1247 published: 1
1248 user_name: vcsp
1249 server_guid: 52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5
1250 storage_backings:
1251 - storage_uri: nfs://datastore.test/srv/share/content-library
1252 type: OTHER
1253 type: LOCAL
1254 version: '2'
1255 _ansible_no_log: null
1256 ansible_loop_var: item
1257 changed: 1
1258 failed: 0
1259 invocation:
1260 module_args:
1261 client_token: null
1262 creation_time: null
1263 description: null
1264 id: null
1265 last_modified_time: null
1266 last_sync_time: null
1267 library_id: 46454797-bbe0-415a-9fe9-3cf2f74a14db
1268 name: null
1269 optimization_info: null
1270 publish_info: null
1271 server_guid: null
1272 session_timeout: null
1273 state: absent
1274 storage_backings: null
1275 subscription_info: null
1276 subscriptions: null
1277 type: null
1278 vcenter_hostname: vcenter.test
1279 vcenter_password: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
1280 vcenter_rest_log_file: /tmp/vmware_rest.log
1281 vcenter_username: [email protected]
1282 vcenter_validate_certs: 0
1283 version: null
1284 item:
1285 creation_time: '2022-11-23T20:02:37.796Z'
1286 description: automated
1287 id: 46454797-bbe0-415a-9fe9-3cf2f74a14db
1288 last_modified_time: '2022-11-23T20:02:37.796Z'
1289 name: my_library_on_nfs_9
1290 publish_info:
1291 authentication_method: NONE
1292 persist_json_enabled: 0
1293 publish_url: https://vcenter.test:443/cls/vcsp/lib/46454797-bbe0-415a-9fe9-3cf2f74a14db/lib.json
1294 published: 1
1295 user_name: vcsp
1296 server_guid: 52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5
1297 storage_backings:
1298 - storage_uri: nfs://datastore.test/srv/share/content-library
1299 type: OTHER
1300 type: LOCAL
1301 version: '2'
1302 value: {}
1303 - _ansible_item_label:
1304 creation_time: '2022-11-23T20:02:38.976Z'
1305 description: automated
1306 id: 209926aa-e3fe-46a5-95f2-501e82a5139b
1307 last_modified_time: '2022-11-23T20:02:38.976Z'
1308 name: my_library_on_nfs_10
1309 publish_info:
1310 authentication_method: NONE
1311 persist_json_enabled: 0
1312 publish_url: https://vcenter.test:443/cls/vcsp/lib/209926aa-e3fe-46a5-95f2-501e82a5139b/lib.json
1313 published: 1
1314 user_name: vcsp
1315 server_guid: 52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5
1316 storage_backings:
1317 - storage_uri: nfs://datastore.test/srv/share/content-library
1318 type: OTHER
1319 type: LOCAL
1320 version: '2'
1321 _ansible_no_log: null
1322 ansible_loop_var: item
1323 changed: 1
1324 failed: 0
1325 invocation:
1326 module_args:
1327 client_token: null
1328 creation_time: null
1329 description: null
1330 id: null
1331 last_modified_time: null
1332 last_sync_time: null
1333 library_id: 209926aa-e3fe-46a5-95f2-501e82a5139b
1334 name: null
1335 optimization_info: null
1336 publish_info: null
1337 server_guid: null
1338 session_timeout: null
1339 state: absent
1340 storage_backings: null
1341 subscription_info: null
1342 subscriptions: null
1343 type: null
1344 vcenter_hostname: vcenter.test
1345 vcenter_password: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
1346 vcenter_rest_log_file: /tmp/vmware_rest.log
1347 vcenter_username: [email protected]
1348 vcenter_validate_certs: 0
1349 version: null
1350 item:
1351 creation_time: '2022-11-23T20:02:38.976Z'
1352 description: automated
1353 id: 209926aa-e3fe-46a5-95f2-501e82a5139b
1354 last_modified_time: '2022-11-23T20:02:38.976Z'
1355 name: my_library_on_nfs_10
1356 publish_info:
1357 authentication_method: NONE
1358 persist_json_enabled: 0
1359 publish_url: https://vcenter.test:443/cls/vcsp/lib/209926aa-e3fe-46a5-95f2-501e82a5139b/lib.json
1360 published: 1
1361 user_name: vcsp
1362 server_guid: 52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5
1363 storage_backings:
1364 - storage_uri: nfs://datastore.test/srv/share/content-library
1365 type: OTHER
1366 type: LOCAL
1367 version: '2'
1368 value: {}
1369 - _ansible_item_label:
1370 creation_time: '2022-11-23T20:06:02.958Z'
1371 description: automated
1372 id: de0e9bff-3bae-45d0-a90c-6c2a01dfbe66
1373 last_modified_time: '2022-11-23T20:06:02.958Z'
1374 name: local_library_001
1375 publish_info:
1376 authentication_method: NONE
1377 persist_json_enabled: 0
1378 publish_url: https://vcenter.test:443/cls/vcsp/lib/de0e9bff-3bae-45d0-a90c-6c2a01dfbe66/lib.json
1379 published: 1
1380 user_name: vcsp
1381 server_guid: 52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5
1382 storage_backings:
1383 - datastore_id: datastore-1065
1384 type: DATASTORE
1385 type: LOCAL
1386 version: '2'
1387 _ansible_no_log: null
1388 ansible_loop_var: item
1389 changed: 1
1390 failed: 0
1391 invocation:
1392 module_args:
1393 client_token: null
1394 creation_time: null
1395 description: null
1396 id: null
1397 last_modified_time: null
1398 last_sync_time: null
1399 library_id: de0e9bff-3bae-45d0-a90c-6c2a01dfbe66
1400 name: null
1401 optimization_info: null
1402 publish_info: null
1403 server_guid: null
1404 session_timeout: null
1405 state: absent
1406 storage_backings: null
1407 subscription_info: null
1408 subscriptions: null
1409 type: null
1410 vcenter_hostname: vcenter.test
1411 vcenter_password: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
1412 vcenter_rest_log_file: /tmp/vmware_rest.log
1413 vcenter_username: [email protected]
1414 vcenter_validate_certs: 0
1415 version: null
1416 item:
1417 creation_time: '2022-11-23T20:06:02.958Z'
1418 description: automated
1419 id: de0e9bff-3bae-45d0-a90c-6c2a01dfbe66
1420 last_modified_time: '2022-11-23T20:06:02.958Z'
1421 name: local_library_001
1422 publish_info:
1423 authentication_method: NONE
1424 persist_json_enabled: 0
1425 publish_url: https://vcenter.test:443/cls/vcsp/lib/de0e9bff-3bae-45d0-a90c-6c2a01dfbe66/lib.json
1426 published: 1
1427 user_name: vcsp
1428 server_guid: 52fb0b5e-ffc3-465b-bf4f-e4e6d5423cf5
1429 storage_backings:
1430 - datastore_id: datastore-1065
1431 type: DATASTORE
1432 type: LOCAL
1433 version: '2'
1434 value: {}
1435 type: list
1436 """
1437
1438
1439 # This structure describes the format of the data expected by the end-points
1440 PAYLOAD_FORMAT = {
1441 "delete": {"query": {}, "body": {}, "path": {"library_id": "library_id"}},
1442 "update": {
1443 "query": {},
1444 "body": {
1445 "creation_time": "creation_time",
1446 "description": "description",
1447 "id": "id",
1448 "last_modified_time": "last_modified_time",
1449 "last_sync_time": "last_sync_time",
1450 "name": "name",
1451 "optimization_info": "optimization_info",
1452 "publish_info": "publish_info",
1453 "security_policy_id": "security_policy_id",
1454 "server_guid": "server_guid",
1455 "storage_backings": "storage_backings",
1456 "subscription_info": "subscription_info",
1457 "type": "type",
1458 "unset_security_policy_id": "unset_security_policy_id",
1459 "version": "version",
1460 },
1461 "path": {"library_id": "library_id"},
1462 },
1463 "create": {
1464 "query": {"client_token": "client_token"},
1465 "body": {
1466 "creation_time": "creation_time",
1467 "description": "description",
1468 "id": "id",
1469 "last_modified_time": "last_modified_time",
1470 "last_sync_time": "last_sync_time",
1471 "name": "name",
1472 "optimization_info": "optimization_info",
1473 "publish_info": "publish_info",
1474 "security_policy_id": "security_policy_id",
1475 "server_guid": "server_guid",
1476 "storage_backings": "storage_backings",
1477 "subscription_info": "subscription_info",
1478 "type": "type",
1479 "unset_security_policy_id": "unset_security_policy_id",
1480 "version": "version",
1481 },
1482 "path": {},
1483 },
1484 "publish": {
1485 "query": {},
1486 "body": {"subscriptions": "subscriptions"},
1487 "path": {"library_id": "library_id"},
1488 },
1489 } # pylint: disable=line-too-long
1490
1491 from ansible.module_utils.basic import env_fallback
1492 import os
1493
1494 if os.getenv("VMWARE_ENABLE_TURBO", False):
1495 try:
1496 from ansible_collections.cloud.common.plugins.module_utils.turbo.module import (
1497 AnsibleTurboModule as AnsibleModule,
1498 )
1499
1500 AnsibleModule.collection_name = "vmware.vmware_rest"
1501 except ImportError:
1502 from ansible.module_utils.basic import AnsibleModule
1503 else:
1504 from ansible.module_utils.basic import AnsibleModule
1505
1506 from ansible_collections.vmware.vmware_rest.plugins.module_utils.vmware_rest import (
1507 exists,
1508 gen_args,
1509 get_device_info,
1510 get_subdevice_type,
1511 open_session,
1512 prepare_payload,
1513 session_timeout,
1514 update_changed_flag,
1515 )
1516
1517
1518 def prepare_argument_spec():
1519 argument_spec = {
1520 "vcenter_hostname": dict(
1521 type="str",
1522 required=True,
1523 fallback=(env_fallback, ["VMWARE_HOST"]),
1524 ),
1525 "vcenter_username": dict(
1526 type="str",
1527 required=True,
1528 fallback=(env_fallback, ["VMWARE_USER"]),
1529 ),
1530 "vcenter_password": dict(
1531 type="str",
1532 required=True,
1533 no_log=True,
1534 fallback=(env_fallback, ["VMWARE_PASSWORD"]),
1535 ),
1536 "vcenter_validate_certs": dict(
1537 type="bool",
1538 required=False,
1539 default=True,
1540 fallback=(env_fallback, ["VMWARE_VALIDATE_CERTS"]),
1541 ),
1542 "vcenter_rest_log_file": dict(
1543 type="str",
1544 required=False,
1545 fallback=(env_fallback, ["VMWARE_REST_LOG_FILE"]),
1546 ),
1547 "session_timeout": dict(
1548 type="float",
1549 required=False,
1550 fallback=(env_fallback, ["VMWARE_SESSION_TIMEOUT"]),
1551 ),
1552 }
1553
1554 argument_spec["client_token"] = {"no_log": True, "type": "str"}
1555 argument_spec["creation_time"] = {"type": "str"}
1556 argument_spec["description"] = {"type": "str"}
1557 argument_spec["id"] = {"type": "str"}
1558 argument_spec["last_modified_time"] = {"type": "str"}
1559 argument_spec["last_sync_time"] = {"type": "str"}
1560 argument_spec["library_id"] = {"type": "str"}
1561 argument_spec["name"] = {"type": "str"}
1562 argument_spec["optimization_info"] = {"type": "dict"}
1563 argument_spec["publish_info"] = {"type": "dict"}
1564 argument_spec["security_policy_id"] = {"type": "str"}
1565 argument_spec["server_guid"] = {"type": "str"}
1566 argument_spec["state"] = {
1567 "type": "str",
1568 "choices": ["absent", "present", "publish"],
1569 "default": "present",
1570 }
1571 argument_spec["storage_backings"] = {"type": "list", "elements": "dict"}
1572 argument_spec["subscription_info"] = {"type": "dict"}
1573 argument_spec["subscriptions"] = {"type": "list", "elements": "dict"}
1574 argument_spec["type"] = {"type": "str", "choices": ["LOCAL", "SUBSCRIBED"]}
1575 argument_spec["unset_security_policy_id"] = {"type": "bool"}
1576 argument_spec["version"] = {"type": "str"}
1577
1578 return argument_spec
1579
1580
1581 async def main():
1582 required_if = list([])
1583
1584 module_args = prepare_argument_spec()
1585 module = AnsibleModule(
1586 argument_spec=module_args, required_if=required_if, supports_check_mode=False
1587 )
1588 if not module.params["vcenter_hostname"]:
1589 module.fail_json("vcenter_hostname cannot be empty")
1590 if not module.params["vcenter_username"]:
1591 module.fail_json("vcenter_username cannot be empty")
1592 if not module.params["vcenter_password"]:
1593 module.fail_json("vcenter_password cannot be empty")
1594 try:
1595 session = await open_session(
1596 vcenter_hostname=module.params["vcenter_hostname"],
1597 vcenter_username=module.params["vcenter_username"],
1598 vcenter_password=module.params["vcenter_password"],
1599 validate_certs=module.params["vcenter_validate_certs"],
1600 log_file=module.params["vcenter_rest_log_file"],
1601 )
1602 except Exception as err:
1603 if hasattr(err, "get_message"):
1604 module.fail_json(err.get_message())
1605 else:
1606 module.fail_json(str(err))
1607 result = await entry_point(module, session)
1608 module.exit_json(**result)
1609
1610
1611 # template: default_module.j2
1612 def build_url(params):
1613 return ("https://{vcenter_hostname}" "/api/content/local-library").format(**params)
1614
1615
1616 async def entry_point(module, session):
1617
1618 if module.params["state"] == "present":
1619 if "_create" in globals():
1620 operation = "create"
1621 else:
1622 operation = "update"
1623 elif module.params["state"] == "absent":
1624 operation = "delete"
1625 else:
1626 operation = module.params["state"]
1627
1628 func = globals()["_" + operation]
1629
1630 return await func(module.params, session)
1631
1632
1633 async def _create(params, session):
1634
1635 lookup_url = per_id_url = build_url(params)
1636 uniquity_keys = ["name"]
1637 comp_func = None
1638
1639 _json = None
1640
1641 if params["library_id"]:
1642 _json = await get_device_info(session, build_url(params), params["library_id"])
1643
1644 if not _json and (uniquity_keys or comp_func):
1645 _json = await exists(
1646 params,
1647 session,
1648 url=lookup_url,
1649 uniquity_keys=uniquity_keys,
1650 per_id_url=per_id_url,
1651 comp_func=comp_func,
1652 )
1653
1654 if _json:
1655 if "value" not in _json: # 7.0.2+
1656 _json = {"value": _json}
1657 if "_update" in globals():
1658 params["library_id"] = _json["id"]
1659 return await globals()["_update"](params, session)
1660
1661 return await update_changed_flag(_json, 200, "get")
1662
1663 payload = prepare_payload(params, PAYLOAD_FORMAT["create"])
1664 _url = ("https://{vcenter_hostname}" "/api/content/local-library").format(**params)
1665 async with session.post(_url, json=payload, **session_timeout(params)) as resp:
1666 if resp.status == 500:
1667 text = await resp.text()
1668 raise Exception(f"Request has failed: status={resp.status}, {text}")
1669 try:
1670 if resp.headers["Content-Type"] == "application/json":
1671 _json = await resp.json()
1672 except KeyError:
1673 _json = {}
1674
1675 if (resp.status in [200, 201]) and "error" not in _json:
1676 if isinstance(_json, str): # 7.0.2 and greater
1677 _id = _json # TODO: fetch the object
1678 elif isinstance(_json, dict) and "value" not in _json:
1679 _id = list(_json["value"].values())[0]
1680 elif isinstance(_json, dict) and "value" in _json:
1681 _id = _json["value"]
1682 _json_device_info = await get_device_info(session, _url, _id)
1683 if _json_device_info:
1684 _json = _json_device_info
1685
1686 return await update_changed_flag(_json, resp.status, "create")
1687
1688
1689 async def _delete(params, session):
1690 _in_query_parameters = PAYLOAD_FORMAT["delete"]["query"].keys()
1691 payload = prepare_payload(params, PAYLOAD_FORMAT["delete"])
1692 subdevice_type = get_subdevice_type("/api/content/local-library/{library_id}")
1693 if subdevice_type and not params[subdevice_type]:
1694 _json = await exists(params, session, build_url(params))
1695 if _json:
1696 params[subdevice_type] = _json["id"]
1697 _url = (
1698 "https://{vcenter_hostname}" "/api/content/local-library/{library_id}"
1699 ).format(**params) + gen_args(params, _in_query_parameters)
1700 async with session.delete(_url, json=payload, **session_timeout(params)) as resp:
1701 try:
1702 if resp.headers["Content-Type"] == "application/json":
1703 _json = await resp.json()
1704 except KeyError:
1705 _json = {}
1706 return await update_changed_flag(_json, resp.status, "delete")
1707
1708
1709 async def _publish(params, session):
1710 _in_query_parameters = PAYLOAD_FORMAT["publish"]["query"].keys()
1711 payload = prepare_payload(params, PAYLOAD_FORMAT["publish"])
1712 subdevice_type = get_subdevice_type(
1713 "/api/content/local-library/{library_id}?action=publish"
1714 )
1715 if subdevice_type and not params[subdevice_type]:
1716 _json = await exists(params, session, build_url(params))
1717 if _json:
1718 params[subdevice_type] = _json["id"]
1719 _url = (
1720 "https://{vcenter_hostname}"
1721 # aa
1722 "/api/content/local-library/{library_id}?action=publish"
1723 ).format(**params) + gen_args(params, _in_query_parameters)
1724 async with session.post(_url, json=payload, **session_timeout(params)) as resp:
1725 try:
1726 if resp.headers["Content-Type"] == "application/json":
1727 _json = await resp.json()
1728 except KeyError:
1729 _json = {}
1730 if "value" not in _json: # 7.0.2
1731 _json = {"value": _json}
1732
1733 return await update_changed_flag(_json, resp.status, "publish")
1734
1735
1736 async def _update(params, session):
1737 payload = prepare_payload(params, PAYLOAD_FORMAT["update"])
1738 _url = (
1739 "https://{vcenter_hostname}" "/api/content/local-library/{library_id}"
1740 ).format(**params)
1741 async with session.get(_url, **session_timeout(params)) as resp:
1742 _json = await resp.json()
1743 if "value" in _json:
1744 value = _json["value"]
1745 else: # 7.0.2 and greater
1746 value = _json
1747 for k, v in value.items():
1748 if k in payload:
1749 if isinstance(payload[k], dict) and isinstance(v, dict):
1750 to_delete = True
1751 for _k in list(payload[k].keys()):
1752 if payload[k][_k] != v.get(_k):
1753 to_delete = False
1754 if to_delete:
1755 del payload[k]
1756 elif payload[k] == v:
1757 del payload[k]
1758 elif payload[k] == {}:
1759 del payload[k]
1760
1761 if payload == {} or payload == {"spec": {}}:
1762 # Nothing has changed
1763 if "value" not in _json: # 7.0.2
1764 _json = {"value": _json}
1765 _json["id"] = params.get("library_id")
1766 return await update_changed_flag(_json, resp.status, "get")
1767 async with session.patch(_url, json=payload, **session_timeout(params)) as resp:
1768 try:
1769 if resp.headers["Content-Type"] == "application/json":
1770 _json = await resp.json()
1771 except KeyError:
1772 _json = {}
1773 if "value" not in _json: # 7.0.2
1774 _json = {"value": _json}
1775
1776 # e.g: content_configuration
1777 if not _json and resp.status == 204:
1778 async with session.get(_url, **session_timeout(params)) as resp_get:
1779 _json_get = await resp_get.json()
1780 if _json_get:
1781 _json = _json_get
1782
1783 _json["id"] = params.get("library_id")
1784 return await update_changed_flag(_json, resp.status, "update")
1785
1786
1787 if __name__ == "__main__":
1788 import asyncio
1789
1790 current_loop = asyncio.new_event_loop()
1791 try:
1792 asyncio.set_event_loop(current_loop)
1793 current_loop.run_until_complete(main())
1794 finally:
1795 current_loop.close()