| 1 | --- |
| 2 | - name: Protection domain Operations |
| 3 | hosts: localhost |
| 4 | connection: local |
| 5 | gather_facts: false |
| 6 | vars: |
| 7 | hostname: 'x.x.x.x' |
| 8 | username: 'admin' |
| 9 | password: 'Password' |
| 10 | validate_certs: false |
| 11 | host_port: 443 |
| 12 | |
| 13 | tasks: |
| 14 | - name: Create Protection Domain |
| 15 | register: result |
| 16 | dellemc.powerflex.protection_domain: |
| 17 | hostname: "{{ hostname }}" |
| 18 | username: "{{ username }}" |
| 19 | password: "{{ password }}" |
| 20 | validate_certs: "{{ validate_certs }}" |
| 21 | port: "{{ host_port }}" |
| 22 | protection_domain_name: "domain_1" |
| 23 | network_limits: |
| 24 | rebuild_limit: 10240 |
| 25 | rebalance_limit: 10240 |
| 26 | vtree_migration_limit: 10240 |
| 27 | overall_limit: 20480 |
| 28 | bandwidth_unit: "KBps" |
| 29 | rf_cache_limits: |
| 30 | page_size: 32 |
| 31 | pass_through_mode: "Write" |
| 32 | state: "present" |
| 33 | |
| 34 | - name: Get Protection Domain |
| 35 | dellemc.powerflex.protection_domain: |
| 36 | hostname: "{{ hostname }}" |
| 37 | username: "{{ username }}" |
| 38 | password: "{{ password }}" |
| 39 | validate_certs: "{{ validate_certs }}" |
| 40 | port: "{{ host_port }}" |
| 41 | protection_domain_name: "domain_1" |
| 42 | state: "present" |
| 43 | |
| 44 | - name: Set Protection Domain id |
| 45 | ansible.builtin.set_fact: |
| 46 | pd_id: "{{ result.protection_domain_details.id }}" |
| 47 | |
| 48 | - name: Get Protection Domain using ID |
| 49 | dellemc.powerflex.protection_domain: |
| 50 | hostname: "{{ hostname }}" |
| 51 | username: "{{ username }}" |
| 52 | password: "{{ password }}" |
| 53 | validate_certs: "{{ validate_certs }}" |
| 54 | port: "{{ host_port }}" |
| 55 | protection_domain_id: "{{ pd_id }}" |
| 56 | state: "present" |
| 57 | |
| 58 | - name: Modify Protection Domain using ID |
| 59 | register: result |
| 60 | dellemc.powerflex.protection_domain: |
| 61 | hostname: "{{ hostname }}" |
| 62 | username: "{{ username }}" |
| 63 | password: "{{ password }}" |
| 64 | validate_certs: "{{ validate_certs }}" |
| 65 | port: "{{ host_port }}" |
| 66 | is_active: false |
| 67 | protection_domain_id: "{{ pd_id }}" |
| 68 | protection_domain_new_name: "domain_1_renamed" |
| 69 | network_limits: |
| 70 | rebuild_limit: 12 |
| 71 | rebalance_limit: 12 |
| 72 | overall_limit: 22 |
| 73 | bandwidth_unit: "GBps" |
| 74 | rf_cache_limits: |
| 75 | is_enabled: false |
| 76 | page_size: 16 |
| 77 | max_io_limit: 128 |
| 78 | pass_through_mode: "Write" |
| 79 | state: "present" |
| 80 | |
| 81 | - name: Modify Protection Domain using ID - Idempotecny |
| 82 | register: result |
| 83 | dellemc.powerflex.protection_domain: |
| 84 | hostname: "{{ hostname }}" |
| 85 | username: "{{ username }}" |
| 86 | password: "{{ password }}" |
| 87 | validate_certs: "{{ validate_certs }}" |
| 88 | port: "{{ host_port }}" |
| 89 | is_active: false |
| 90 | protection_domain_id: "{{ pd_id }}" |
| 91 | protection_domain_new_name: "domain_1_renamed" |
| 92 | network_limits: |
| 93 | rebuild_limit: 12 |
| 94 | rebalance_limit: 12 |
| 95 | overall_limit: 22 |
| 96 | bandwidth_unit: "GBps" |
| 97 | rf_cache_limits: |
| 98 | is_enabled: false |
| 99 | page_size: 16 |
| 100 | max_io_limit: 128 |
| 101 | pass_through_mode: "Write" |
| 102 | state: "present" |
| 103 | |
| 104 | - name: Delete Protection Domain using ID |
| 105 | register: result |
| 106 | dellemc.powerflex.protection_domain: |
| 107 | hostname: "{{ hostname }}" |
| 108 | username: "{{ username }}" |
| 109 | password: "{{ password }}" |
| 110 | validate_certs: "{{ validate_certs }}" |
| 111 | port: "{{ host_port }}" |
| 112 | protection_domain_id: "{{ pd_id }}" |
| 113 | state: "absent" |
| 114 | |
| 115 | - name: Delete Protection Domain - Idempotecny |
| 116 | register: result |
| 117 | dellemc.powerflex.protection_domain: |
| 118 | hostname: "{{ hostname }}" |
| 119 | username: "{{ username }}" |
| 120 | password: "{{ password }}" |
| 121 | validate_certs: "{{ validate_certs }}" |
| 122 | port: "{{ host_port }}" |
| 123 | protection_domain_name: "domain_1_renamed" |
| 124 | state: "absent" |