| 1 | --- |
| 2 | - name: Tree Quota Operations |
| 3 | hosts: localhost |
| 4 | connection: local |
| 5 | vars: |
| 6 | unispherehost: '10.*.*.*' |
| 7 | validate_certs: false |
| 8 | username: 'user' |
| 9 | password: '**' |
| 10 | filesystem_name: "SP_Filesystem_test" |
| 11 | filesystem_id: "fs_2279" |
| 12 | nas_server_name: "lglad068" |
| 13 | path: "/sample_quota" |
| 14 | soft_limit: 2 |
| 15 | state_present: "present" |
| 16 | state_absent: "absent" |
| 17 | |
| 18 | tasks: |
| 19 | - name: Create quota tree of filesystem |
| 20 | register: result |
| 21 | tree_quota: |
| 22 | unispherehost: "{{ unispherehost }}" |
| 23 | username: "{{ username }}" |
| 24 | password: "{{ password }}" |
| 25 | validate_certs: "{{ validate_certs }}" |
| 26 | filesystem_id: "{{ filesystem_id }}" |
| 27 | path: "{{ path }}" |
| 28 | hard_limit: 2 |
| 29 | cap_unit: "TB" |
| 30 | description: "Sample quota tree" |
| 31 | state: "{{ state_present }}" |
| 32 | |
| 33 | - name: Set tree_quota_id |
| 34 | ansible.builtin.set_fact: |
| 35 | tree_quota_id: "{{ result.get_tree_quota_details.id }}" |
| 36 | |
| 37 | - name: Create quota tree of filesystem -- Idempotency |
| 38 | tree_quota: |
| 39 | unispherehost: "{{ unispherehost }}" |
| 40 | username: "{{ username }}" |
| 41 | password: "{{ password }}" |
| 42 | validate_certs: "{{ validate_certs }}" |
| 43 | filesystem_id: "{{ filesystem_id }}" |
| 44 | path: "{{ path }}" |
| 45 | hard_limit: 2 |
| 46 | cap_unit: "TB" |
| 47 | description: "Sample quota tree" |
| 48 | state: "{{ state_present }}" |
| 49 | |
| 50 | - name: Get quota tree details by quota tree path |
| 51 | tree_quota: |
| 52 | unispherehost: "{{ unispherehost }}" |
| 53 | username: "{{ username }}" |
| 54 | password: "{{ password }}" |
| 55 | validate_certs: "{{ validate_certs }}" |
| 56 | filesystem_id: "{{ filesystem_id }}" |
| 57 | path: "{{ path }}" |
| 58 | state: "{{ state_present }}" |
| 59 | |
| 60 | - name: Get quota tree details by quota tree id |
| 61 | tree_quota: |
| 62 | unispherehost: "{{ unispherehost }}" |
| 63 | username: "{{ username }}" |
| 64 | password: "{{ password }}" |
| 65 | validate_certs: "{{ validate_certs }}" |
| 66 | filesystem_id: "{{ filesystem_id }}" |
| 67 | tree_quota_id: "{{ tree_quota_id }}" |
| 68 | state: "{{ state_present }}" |
| 69 | |
| 70 | - name: Modify quota tree of filesystem by quota tree path |
| 71 | tree_quota: |
| 72 | unispherehost: "{{ unispherehost }}" |
| 73 | username: "{{ username }}" |
| 74 | password: "{{ password }}" |
| 75 | validate_certs: "{{ validate_certs }}" |
| 76 | filesystem_id: "{{ filesystem_id }}" |
| 77 | path: "{{ path }}" |
| 78 | soft_limit: "{{ soft_limit }}" |
| 79 | cap_unit: "TB" |
| 80 | description: "Sample quota tree modified" |
| 81 | state: "{{ state_present }}" |
| 82 | |
| 83 | - name: Modify quota tree of filesystem -- Idempotency |
| 84 | tree_quota: |
| 85 | unispherehost: "{{ unispherehost }}" |
| 86 | username: "{{ username }}" |
| 87 | password: "{{ password }}" |
| 88 | validate_certs: "{{ validate_certs }}" |
| 89 | filesystem_id: "{{ filesystem_id }}" |
| 90 | path: "{{ path }}" |
| 91 | soft_limit: "{{ soft_limit }}" |
| 92 | cap_unit: "TB" |
| 93 | description: "Sample quota tree modified" |
| 94 | state: "{{ state_present }}" |
| 95 | |
| 96 | - name: Modify quota tree of filesystem by quota tree id |
| 97 | tree_quota: |
| 98 | unispherehost: "{{ unispherehost }}" |
| 99 | username: "{{ username }}" |
| 100 | password: "{{ password }}" |
| 101 | validate_certs: "{{ validate_certs }}" |
| 102 | filesystem_name: "{{ filesystem_name }}" |
| 103 | nas_server_name: "{{ nas_server_name }}" |
| 104 | tree_quota_id: "{{ tree_quota_id }}" |
| 105 | soft_limit: "{{ soft_limit }}" |
| 106 | cap_unit: "TB" |
| 107 | description: "Sample quota tree modified" |
| 108 | state: "{{ state_present }}" |
| 109 | |
| 110 | - name: Delete quota tree of filesystem by quota tree path |
| 111 | tree_quota: |
| 112 | unispherehost: "{{ unispherehost }}" |
| 113 | username: "{{ username }}" |
| 114 | password: "{{ password }}" |
| 115 | validate_certs: "{{ validate_certs }}" |
| 116 | filesystem_id: "{{ filesystem_id }}" |
| 117 | path: "{{ path }}" |
| 118 | state: "{{ state_absent }}" |
| 119 | |
| 120 | - name: Delete quota tree of filesystem -- Idempotency |
| 121 | tree_quota: |
| 122 | unispherehost: "{{ unispherehost }}" |
| 123 | username: "{{ username }}" |
| 124 | password: "{{ password }}" |
| 125 | validate_certs: "{{ validate_certs }}" |
| 126 | filesystem_id: "{{ filesystem_id }}" |
| 127 | path: "{{ path }}" |
| 128 | state: "{{ state_absent }}" |
| 129 | |
| 130 | - name: Delete quota tree of filesystem by quota tree id |
| 131 | tree_quota: |
| 132 | unispherehost: "{{ unispherehost }}" |
| 133 | username: "{{ username }}" |
| 134 | password: "{{ password }}" |
| 135 | validate_certs: "{{ validate_certs }}" |
| 136 | filesystem_id: "{{ filesystem_id }}" |
| 137 | tree_quota_id: "treequota_171798700679_1" |
| 138 | state: "{{ state_absent }}" |