| 1 | --- |
| 2 | - name: FileSystem Operations |
| 3 | hosts: localhost |
| 4 | connection: local |
| 5 | vars: |
| 6 | unispherehost: '10.*.*.*' |
| 7 | validate_certs: false |
| 8 | username: 'user' |
| 9 | password: '**' |
| 10 | filesystem_name: "FS_Ansible" |
| 11 | nas_server_name: "lgla**" |
| 12 | size: 10 |
| 13 | pool_name: "Ansible_Unity_SP_2" |
| 14 | cap_gb: "GB" |
| 15 | description: "Ansible demo" |
| 16 | snap_schedule_name_1: "SS9_empty_DesRet_SS" |
| 17 | snap_schedule_name_2: "Ansible_vol_snap_schedule1" |
| 18 | pool_id: "pool_2" |
| 19 | tiering_policy: "LOWEST" |
| 20 | is_thin: true |
| 21 | data_reduction: true |
| 22 | state_present: "present" |
| 23 | state_absent: "absent" |
| 24 | state_mapped: "mapped" |
| 25 | state_unmapped: "unmapped" |
| 26 | |
| 27 | tasks: |
| 28 | - name: Create FileSystem |
| 29 | filesystem: |
| 30 | unispherehost: "{{ unispherehost }}" |
| 31 | username: "{{ username }}" |
| 32 | password: "{{ password }}" |
| 33 | validate_certs: "{{ validate_certs }}" |
| 34 | filesystem_name: "{{ filesystem_name }}" |
| 35 | nas_server_name: "{{ nas_server_name }}" |
| 36 | pool_name: "{{ pool_name }}" |
| 37 | size: "{{ size }}" |
| 38 | description: "{{ description }}" |
| 39 | snap_schedule_name: "{{ snap_schedule_name_2 }}" |
| 40 | state: "{{ state_present }}" |
| 41 | register: fs_result |
| 42 | |
| 43 | - name: Create FileSystem - idempotency |
| 44 | filesystem: |
| 45 | unispherehost: "{{ unispherehost }}" |
| 46 | username: "{{ username }}" |
| 47 | password: "{{ password }}" |
| 48 | validate_certs: "{{ validate_certs }}" |
| 49 | filesystem_name: "{{ filesystem_name }}" |
| 50 | nas_server_name: "{{ nas_server_name }}" |
| 51 | pool_name: "{{ pool_name }}" |
| 52 | size: "{{ size }}" |
| 53 | description: "{{ description }}" |
| 54 | snap_schedule_name: "{{ snap_schedule_name_2 }}" |
| 55 | state: "{{ state_present }}" |
| 56 | |
| 57 | - name: Set filesystem_id |
| 58 | ansible.builtin.set_fact: |
| 59 | filesystem_id: "{{ fs_result.filesystem_details.id }}" |
| 60 | |
| 61 | - name: Create FileSystem with quota configuration |
| 62 | filesystem: |
| 63 | unispherehost: "{{ unispherehost }}" |
| 64 | username: "{{ username }}" |
| 65 | password: "{{ password }}" |
| 66 | validate_certs: "{{ validate_certs }}" |
| 67 | filesystem_name: "SP_FS_test_quota_config_1" |
| 68 | nas_server_name: "{{ nas_server_name }}" |
| 69 | pool_id: "{{ pool_id }}" |
| 70 | size: "{{ size }}" |
| 71 | description: "{{ description }}" |
| 72 | quota_config: |
| 73 | default_hard_limit: 10 |
| 74 | grace_period_unit: "minutes" |
| 75 | is_user_quota_enabled: true |
| 76 | grace_period: 100 |
| 77 | state: "{{ state_present }}" |
| 78 | |
| 79 | - name: Create FileSystem with quota configuration -- Idempotency |
| 80 | filesystem: |
| 81 | unispherehost: "{{ unispherehost }}" |
| 82 | username: "{{ username }}" |
| 83 | password: "{{ password }}" |
| 84 | validate_certs: "{{ validate_certs }}" |
| 85 | filesystem_name: "SP_FS_test_quota_config_1" |
| 86 | nas_server_name: "{{ nas_server_name }}" |
| 87 | pool_id: "{{ pool_id }}" |
| 88 | size: "{{ size }}" |
| 89 | description: "{{ description }}" |
| 90 | quota_config: |
| 91 | default_hard_limit: 10 |
| 92 | grace_period_unit: "minutes" |
| 93 | is_user_quota_enabled: true |
| 94 | grace_period: 100 |
| 95 | state: "{{ state_present }}" |
| 96 | |
| 97 | - name: Expand FileSystem Size |
| 98 | filesystem: |
| 99 | unispherehost: "{{ unispherehost }}" |
| 100 | username: "{{ username }}" |
| 101 | password: "{{ password }}" |
| 102 | validate_certs: "{{ validate_certs }}" |
| 103 | filesystem_id: "{{ filesystem_id }}" |
| 104 | size: 15 |
| 105 | state: "present" |
| 106 | |
| 107 | - name: Expand FileSystem Size - Idempotency |
| 108 | filesystem: |
| 109 | unispherehost: "{{ unispherehost }}" |
| 110 | username: "{{ username }}" |
| 111 | password: "{{ password }}" |
| 112 | validate_certs: "{{ validate_certs }}" |
| 113 | filesystem_id: "{{ filesystem_id }}" |
| 114 | size: 15 |
| 115 | state: "present" |
| 116 | |
| 117 | - name: Modify FileSystem smb_properties |
| 118 | filesystem: |
| 119 | unispherehost: "{{ unispherehost }}" |
| 120 | username: "{{ username }}" |
| 121 | password: "{{ password }}" |
| 122 | validate_certs: "{{ validate_certs }}" |
| 123 | filesystem_id: "{{ filesystem_id }}" |
| 124 | smb_properties: |
| 125 | is_smb_op_locks_enabled: true |
| 126 | smb_notify_on_change_dir_depth: 5 |
| 127 | is_smb_notify_on_access_enabled: true |
| 128 | state: "present" |
| 129 | |
| 130 | - name: Modify FileSystem smb_properties - Idempotency |
| 131 | filesystem: |
| 132 | unispherehost: "{{ unispherehost }}" |
| 133 | username: "{{ username }}" |
| 134 | password: "{{ password }}" |
| 135 | validate_certs: "{{ validate_certs }}" |
| 136 | filesystem_id: "{{ filesystem_id }}" |
| 137 | smb_properties: |
| 138 | is_smb_op_locks_enabled: true |
| 139 | smb_notify_on_change_dir_depth: 5 |
| 140 | is_smb_notify_on_access_enabled: true |
| 141 | state: "present" |
| 142 | |
| 143 | - name: Modify FileSystem snap schedule |
| 144 | filesystem: |
| 145 | unispherehost: "{{ unispherehost }}" |
| 146 | username: "{{ username }}" |
| 147 | password: "{{ password }}" |
| 148 | validate_certs: "{{ validate_certs }}" |
| 149 | filesystem_id: "{{ filesystem_id }}" |
| 150 | snap_schedule_name: "{{ snap_schedule_name_1 }}" |
| 151 | state: "{{ state_present }}" |
| 152 | |
| 153 | - name: Modify FileSystem snap schedule - Idempotency |
| 154 | filesystem: |
| 155 | unispherehost: "{{ unispherehost }}" |
| 156 | username: "{{ username }}" |
| 157 | password: "{{ password }}" |
| 158 | validate_certs: "{{ validate_certs }}" |
| 159 | filesystem_id: "{{ filesystem_id }}" |
| 160 | snap_schedule_name: "{{ snap_schedule_name_1 }}" |
| 161 | state: "{{ state_present }}" |
| 162 | |
| 163 | - name: Remove snap-schedule from filesystem |
| 164 | filesystem: |
| 165 | unispherehost: "{{ unispherehost }}" |
| 166 | username: "{{ username }}" |
| 167 | password: "{{ password }}" |
| 168 | validate_certs: "{{ validate_certs }}" |
| 169 | filesystem_id: "{{ filesystem_id }}" |
| 170 | snap_schedule_name: "" |
| 171 | state: "{{ state_present }}" |
| 172 | |
| 173 | - name: Get details of FileSystem using id |
| 174 | filesystem: |
| 175 | unispherehost: "{{ unispherehost }}" |
| 176 | username: "{{ username }}" |
| 177 | password: "{{ password }}" |
| 178 | validate_certs: "{{ validate_certs }}" |
| 179 | filesystem_id: "{{ filesystem_id }}" |
| 180 | state: "present" |
| 181 | |
| 182 | - name: Delete a FileSystem using id |
| 183 | filesystem: |
| 184 | unispherehost: "{{ unispherehost }}" |
| 185 | username: "{{ username }}" |
| 186 | password: "{{ password }}" |
| 187 | validate_certs: "{{ validate_certs }}" |
| 188 | filesystem_id: "{{ filesystem_id }}" |
| 189 | state: "absent" |
| 190 | |
| 191 | - name: Delete a FileSystem using id -Idempotency |
| 192 | filesystem: |
| 193 | unispherehost: "{{ unispherehost }}" |
| 194 | username: "{{ username }}" |
| 195 | password: "{{ password }}" |
| 196 | validate_certs: "{{ validate_certs }}" |
| 197 | filesystem_id: "{{ filesystem_id }}" |
| 198 | state: "absent" |
| 199 | |
| 200 | - name: Enable replication for filesystem |
| 201 | filesystem: |
| 202 | unispherehost: "{{ unispherehost }}" |
| 203 | username: "{{ username }}" |
| 204 | password: "{{ password }}" |
| 205 | validate_certs: "{{ validate_certs }}" |
| 206 | filesystem_name: "test_fs_rrepl_repl" |
| 207 | nas_server_name: "test_nas1" |
| 208 | replication_params: |
| 209 | replication_name: "local_repl_new" |
| 210 | replication_mode: "asynchronous" |
| 211 | replication_type: "remote" |
| 212 | rpo: 20 |
| 213 | remote_system: |
| 214 | remote_system_host: '10.*.*.*' |
| 215 | remote_system_verifycert: false |
| 216 | remote_system_username: 'user' |
| 217 | remote_system_password: '**' |
| 218 | destination_pool_name: "test_pool" |
| 219 | replication_state: "enable" |
| 220 | state: "present" |
| 221 | |
| 222 | - name: Enable replication for filesystem - Idempotency |
| 223 | filesystem: |
| 224 | unispherehost: "{{ unispherehost }}" |
| 225 | username: "{{ username }}" |
| 226 | password: "{{ password }}" |
| 227 | validate_certs: "{{ validate_certs }}" |
| 228 | filesystem_name: "test_fs_rrepl_repl" |
| 229 | nas_server_name: "test_nas1" |
| 230 | replication_params: |
| 231 | replication_name: "local_repl_new" |
| 232 | replication_mode: "asynchronous" |
| 233 | replication_type: "remote" |
| 234 | rpo: 20 |
| 235 | remote_system: |
| 236 | remote_system_host: '10.*.*.*' |
| 237 | remote_system_verifycert: false |
| 238 | remote_system_username: 'user' |
| 239 | remote_system_password: '**' |
| 240 | destination_pool_name: "test_pool" |
| 241 | replication_state: "enable" |
| 242 | state: "present" |
| 243 | |
| 244 | - name: Modify replication for filesystem |
| 245 | filesystem: |
| 246 | unispherehost: "{{ unispherehost }}" |
| 247 | username: "{{ username }}" |
| 248 | password: "{{ password }}" |
| 249 | validate_certs: "{{ validate_certs }}" |
| 250 | filesystem_name: "test_fs_rrepl_repl" |
| 251 | nas_server_name: "test_nas1" |
| 252 | replication_params: |
| 253 | replication_name: "local_repl_new" |
| 254 | new_replication_name: "local_repl_234" |
| 255 | replication_mode: "asynchronous" |
| 256 | replication_state: "enable" |
| 257 | state: "present" |
| 258 | |
| 259 | - name: Disable replication for filesystem |
| 260 | filesystem: |
| 261 | unispherehost: "{{ unispherehost }}" |
| 262 | username: "{{ username }}" |
| 263 | password: "{{ password }}" |
| 264 | validate_certs: "{{ validate_certs }}" |
| 265 | filesystem_name: "test_fs_rrepl_repl" |
| 266 | nas_server_name: "test_nas1" |
| 267 | replication_params: |
| 268 | replication_name: "local_repl_234" |
| 269 | replication_state: "disable" |
| 270 | state: "present" |
| 271 | |
| 272 | - name: Disable replication for filesystem - Idempotency |
| 273 | filesystem: |
| 274 | unispherehost: "{{ unispherehost }}" |
| 275 | username: "{{ username }}" |
| 276 | password: "{{ password }}" |
| 277 | validate_certs: "{{ validate_certs }}" |
| 278 | filesystem_name: "test_fs_rrepl_repl" |
| 279 | nas_server_name: "test_nas1" |
| 280 | replication_state: "disable" |
| 281 | state: "present" |