| 1 | --- |
| 2 | - name: Storage pool Module Operations on Unity |
| 3 | hosts: localhost |
| 4 | connection: local |
| 5 | vars: |
| 6 | unispherehost: '10.*.*.*' |
| 7 | validate_certs: false |
| 8 | username: 'user' |
| 9 | password: '**' |
| 10 | pool_name: "test_DND" |
| 11 | new_pool_name: "new_pool2" |
| 12 | fast_vp_enabled: "enabled" |
| 13 | fast_cache_enabled: "enabled" |
| 14 | pool_description: "updated" |
| 15 | disk_group_id: "dg_16" |
| 16 | disk_num: 2 |
| 17 | raid_type: "RAID10" |
| 18 | stripe_width: "BEST_FIT" |
| 19 | alert_threshold: 50 |
| 20 | is_harvest_enabled: true |
| 21 | pool_harvest_high_threshold: 59 |
| 22 | pool_harvest_low_threshold: 40 |
| 23 | is_snap_harvest_enabled: true |
| 24 | snap_harvest_high_threshold: 80 |
| 25 | snap_harvest_low_threshold: 60 |
| 26 | pool_type: "DYNAMIC" |
| 27 | |
| 28 | tasks: |
| 29 | - name: Get the details of the full storage pool by name |
| 30 | storagepool: |
| 31 | unispherehost: "{{ unispherehost }}" |
| 32 | username: "{{ username }}" |
| 33 | password: "{{ password }}" |
| 34 | validate_certs: "{{ validate_certs }}" |
| 35 | pool_name: "Test_Pool" |
| 36 | pool_description: "test pool" |
| 37 | raid_groups: |
| 38 | disk_group_id: "dg_36" |
| 39 | disk_num: 3 |
| 40 | raid_type: "RAID10" |
| 41 | stripe_width: "BEST_FIT" |
| 42 | alert_threshold: 50 |
| 43 | is_harvest_enabled: true |
| 44 | pool_harvest_high_threshold: 60 |
| 45 | pool_harvest_low_threshold: 40 |
| 46 | is_snap_harvest_enabled: true |
| 47 | snap_harvest_high_threshold: 70 |
| 48 | snap_harvest_low_threshold: 50 |
| 49 | fast_vp: "enabled" |
| 50 | fast_cache: "enabled" |
| 51 | pool_type: "DYNAMIC" |
| 52 | state: "present" |
| 53 | |
| 54 | - name: Get the details of Storage pool by name |
| 55 | register: result |
| 56 | storagepool: |
| 57 | unispherehost: "{{ unispherehost }}" |
| 58 | username: "{{ username }}" |
| 59 | password: "{{ password }}" |
| 60 | validate_certs: "{{ validate_certs }}" |
| 61 | pool_name: "{{ pool_name }}" |
| 62 | state: "present" |
| 63 | |
| 64 | - name: Set storage pool id |
| 65 | ansible.builtin.set_fact: |
| 66 | pool_id: "{{ result.storage_pool_details.id }}" |
| 67 | |
| 68 | - name: Get the details of Storage pool by pool id |
| 69 | storagepool: |
| 70 | unispherehost: "{{ unispherehost }}" |
| 71 | username: "{{ username }}" |
| 72 | password: "{{ password }}" |
| 73 | validate_certs: "{{ validate_certs }}" |
| 74 | pool_id: "{{ pool_id }}" |
| 75 | state: "present" |
| 76 | |
| 77 | - name: Rename Storage pool by name |
| 78 | storagepool: |
| 79 | unispherehost: "{{ unispherehost }}" |
| 80 | username: "{{ username }}" |
| 81 | password: "{{ password }}" |
| 82 | validate_certs: "{{ validate_certs }}" |
| 83 | pool_name: "{{ pool_name }}" |
| 84 | new_pool_name: "{{ new_pool_name }}" |
| 85 | state: "present" |
| 86 | |
| 87 | - name: Update Storage pool description |
| 88 | storagepool: |
| 89 | unispherehost: "{{ unispherehost }}" |
| 90 | username: "{{ username }}" |
| 91 | password: "{{ password }}" |
| 92 | validate_certs: "{{ validate_certs }}" |
| 93 | pool_name: "{{ new_pool_name }}" |
| 94 | pool_description: "{{ pool_description }}" |
| 95 | state: "present" |
| 96 | |
| 97 | - name: Update Storage pool description- Idempotent |
| 98 | storagepool: |
| 99 | unispherehost: "{{ unispherehost }}" |
| 100 | username: "{{ username }}" |
| 101 | password: "{{ password }}" |
| 102 | validate_certs: "{{ validate_certs }}" |
| 103 | pool_name: "{{ new_pool_name }}" |
| 104 | pool_description: "{{ pool_description }}" |
| 105 | state: "present" |
| 106 | |
| 107 | - name: Update fast_vp by pool name |
| 108 | storagepool: |
| 109 | unispherehost: "{{ unispherehost }}" |
| 110 | username: "{{ username }}" |
| 111 | password: "{{ password }}" |
| 112 | validate_certs: "{{ validate_certs }}" |
| 113 | pool_name: "{{ new_pool_name }}" |
| 114 | fast_vp: "{{ fast_vp_enabled }}" |
| 115 | state: "present" |
| 116 | |
| 117 | - name: Update fast_cache by pool name |
| 118 | storagepool: |
| 119 | unispherehost: "{{ unispherehost }}" |
| 120 | username: "{{ username }}" |
| 121 | password: "{{ password }}" |
| 122 | validate_certs: "{{ validate_certs }}" |
| 123 | pool_name: "{{ new_pool_name }}" |
| 124 | fast_cache: "{{ fast_cache_enabled }}" |
| 125 | state: "present" |
| 126 | |
| 127 | - name: Rename Storage pool by name back to original |
| 128 | storagepool: |
| 129 | unispherehost: "{{ unispherehost }}" |
| 130 | username: "{{ username }}" |
| 131 | password: "{{ password }}" |
| 132 | validate_certs: "{{ validate_certs }}" |
| 133 | pool_name: "{{ new_pool_name }}" |
| 134 | new_pool_name: "{{ pool_name }}" |
| 135 | state: "present" |
| 136 | |
| 137 | - name: Create a Storage pool |
| 138 | storagepool: |
| 139 | unispherehost: "{{ unispherehost }}" |
| 140 | username: "{{ username }}" |
| 141 | password: "{{ password }}" |
| 142 | validate_certs: "{{ validate_certs }}" |
| 143 | pool_name: "test_pool" |
| 144 | pool_description: "Unity test pool." |
| 145 | raid_groups: |
| 146 | disk_group_id: "{{ disk_group_id }}" |
| 147 | disk_num: "{{ disk_num }}" |
| 148 | raid_type: "{{ raid_type }}" |
| 149 | stripe_width: "{{ stripe_width }}" |
| 150 | alert_threshold: "{{ alert_threshold }}" |
| 151 | is_harvest_enabled: "{{ is_harvest_enabled }}" |
| 152 | pool_harvest_high_threshold: "{{ pool_harvest_high_threshold }}" |
| 153 | pool_harvest_low_threshold: "{{ pool_harvest_low_threshold }}" |
| 154 | is_snap_harvest_enabled: "{{ is_snap_harvest_enabled }}" |
| 155 | snap_harvest_high_threshold: "{{ snap_harvest_high_threshold }}" |
| 156 | snap_harvest_low_threshold: "{{ snap_harvest_low_threshold }}" |
| 157 | fast_vp: "{{ fast_vp_enabled }}" |
| 158 | fast_cache: "{{ fast_cache_enabled }}" |
| 159 | pool_type: "DYNAMIC" |
| 160 | state: "present" |
| 161 | |
| 162 | - name: Create a StoragePool - idempotency |
| 163 | storagepool: |
| 164 | unispherehost: "{{ unispherehost }}" |
| 165 | username: "{{ username }}" |
| 166 | password: "{{ password }}" |
| 167 | validate_certs: "{{ validate_certs }}" |
| 168 | pool_name: "test_pool" |
| 169 | pool_description: "Unity test pool." |
| 170 | raid_groups: |
| 171 | disk_group_id: "{{ disk_group_id }}" |
| 172 | disk_num: "{{ disk_num }}" |
| 173 | raid_type: "{{ raid_type }}" |
| 174 | stripe_width: "{{ stripe_width }}" |
| 175 | alert_threshold: "{{ alert_threshold }}" |
| 176 | is_harvest_enabled: "{{ is_harvest_enabled }}" |
| 177 | pool_harvest_high_threshold: "{{ pool_harvest_high_threshold }}" |
| 178 | pool_harvest_low_threshold: "{{ pool_harvest_low_threshold }}" |
| 179 | is_snap_harvest_enabled: "{{ is_snap_harvest_enabled }}" |
| 180 | snap_harvest_high_threshold: "{{ snap_harvest_high_threshold }}" |
| 181 | snap_harvest_low_threshold: "{{ snap_harvest_low_threshold }}" |
| 182 | fast_vp: "{{ fast_vp_enabled }}" |
| 183 | fast_cache: "{{ fast_cache_enabled }}" |
| 184 | pool_type: "DYNAMIC" |
| 185 | state: "present" |