forked from VeritasOS/netbackup-api-code-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new file added for vmware asset-groups
vmware asset groups post for vmware filter based on folders.
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
### Requirements | ||
# inputs from parent - {{login_token}}, | ||
# inputs from inventory - {{master}}, {{vcenter}}, {{baseurl}}, {{contenttype}} | ||
# outputs {{protectionplan}}, {{pp_id}} | ||
|
||
- name: add corp folder protection plan | ||
uri: | ||
url: "{{baseurl}}asset-groups" | ||
method: post | ||
body_format: json | ||
headers: | ||
authorization: "{{login_token}}" | ||
content-type: "{{contenttype}}" | ||
body: | ||
data: | ||
attributes: | ||
displayName: "{{item.seg}}-folder-test" | ||
description: "selects all {{item.seg}} folders for all vcenters in region" | ||
oDataQueryFilter: "contains(extendedAttributes/vmFolder, '{{item.seg}}') or (contains(extendedAttributes/vmFolder, '{{item.type}}'))" | ||
vipQueryFilter: "((VMFolder Contains '{{item.seg}}') OR (VMFolder Contains '{{item.type}}')) AND ((vCenter Equal '{{vcenter}}') OR (ESXserver Equal '{{vcenter}}'))" | ||
assetType: "Virtual Machine" | ||
workloadType: VMware | ||
filterConstraint: "{{vcenter}}" | ||
type: assetGroup | ||
port: 0 | ||
validate: true | ||
status_code: 201 | ||
validate_certs: no | ||
return_content: yes | ||
with_items: | ||
- {seg: 'BU1', type: 'Image Backup' } | ||
- {seg: 'BU2', type: 'Image Backup' } | ||
- {seg: 'BU3', type: 'Image Backup' } | ||
register: protectionplan | ||
ignore_errors: true | ||
|
||
- name : debug protectionplan var | ||
debug: | ||
msg: "{{protectionplan}}" | ||
|
||
- name: Set Fact - Protection Plan ID | ||
set_fact: | ||
pp_id: "{{protectionplan.json.data.id}}" |