|
| 1 | +--- |
| 2 | +### Requirements |
| 3 | +# inputs from parent - {{login_token}}, |
| 4 | +# inputs from inventory - {{master}}, {{vcenter}}, {{baseurl}}, {{contenttype}} |
| 5 | +# outputs {{protectionplan}}, {{pp_id}} |
| 6 | + |
| 7 | + - name: add corp folder protection plan |
| 8 | + uri: |
| 9 | + url: "{{baseurl}}asset-groups" |
| 10 | + method: post |
| 11 | + body_format: json |
| 12 | + headers: |
| 13 | + authorization: "{{login_token}}" |
| 14 | + content-type: "{{contenttype}}" |
| 15 | + body: |
| 16 | + data: |
| 17 | + attributes: |
| 18 | + displayName: "{{item.seg}}-folder-test" |
| 19 | + description: "selects all {{item.seg}} folders for all vcenters in region" |
| 20 | + oDataQueryFilter: "contains(extendedAttributes/vmFolder, '{{item.seg}}') or (contains(extendedAttributes/vmFolder, '{{item.type}}'))" |
| 21 | + vipQueryFilter: "((VMFolder Contains '{{item.seg}}') OR (VMFolder Contains '{{item.type}}')) AND ((vCenter Equal '{{vcenter}}') OR (ESXserver Equal '{{vcenter}}'))" |
| 22 | + assetType: "Virtual Machine" |
| 23 | + workloadType: VMware |
| 24 | + filterConstraint: "{{vcenter}}" |
| 25 | + type: assetGroup |
| 26 | + port: 0 |
| 27 | + validate: true |
| 28 | + status_code: 201 |
| 29 | + validate_certs: no |
| 30 | + return_content: yes |
| 31 | + with_items: |
| 32 | + - {seg: 'BU1', type: 'Image Backup' } |
| 33 | + - {seg: 'BU2', type: 'Image Backup' } |
| 34 | + - {seg: 'BU3', type: 'Image Backup' } |
| 35 | + register: protectionplan |
| 36 | + ignore_errors: true |
| 37 | + |
| 38 | + - name : debug protectionplan var |
| 39 | + debug: |
| 40 | + msg: "{{protectionplan}}" |
| 41 | + |
| 42 | + - name: Set Fact - Protection Plan ID |
| 43 | + set_fact: |
| 44 | + pp_id: "{{protectionplan.json.data.id}}" |
0 commit comments