|
| 1 | +--- |
| 2 | +- name: setup instance |
| 3 | + ngine_io.cloudstack.instance: |
| 4 | + name: "{{ cs_resource_prefix }}-vm-snapshot-policy" |
| 5 | + template: "{{ cs_common_template }}" |
| 6 | + zone: "{{ cs_common_zone_adv }}" |
| 7 | + service_offering: "{{ cs_common_service_offering }}" |
| 8 | + register: instance |
| 9 | +- name: verify setup instance |
| 10 | + assert: |
| 11 | + that: |
| 12 | + - instance is successful |
| 13 | + |
| 14 | +- name: setup snapshot policy absent |
| 15 | + ngine_io.cloudstack.volume_snapshot_policy: |
| 16 | + vm: "{{ cs_resource_prefix }}-vm-snapshot-policy" |
| 17 | + interval_type: hourly |
| 18 | + state: absent |
| 19 | + register: snapshot |
| 20 | +- name: verify setup snapshot policy absent |
| 21 | + assert: |
| 22 | + that: |
| 23 | + - snapshot is successful |
| 24 | + |
| 25 | +- name: create snapshot policy in check mode |
| 26 | + ngine_io.cloudstack.volume_snapshot_policy: |
| 27 | + vm: "{{ cs_resource_prefix }}-vm-snapshot-policy" |
| 28 | + interval_type: hourly |
| 29 | + schedule: 5 |
| 30 | + check_mode: true |
| 31 | + register: snapshot |
| 32 | +- name: verify create snapshot policy in check mode |
| 33 | + assert: |
| 34 | + that: |
| 35 | + - snapshot is changed |
| 36 | + |
| 37 | +- name: create snapshot policy |
| 38 | + ngine_io.cloudstack.volume_snapshot_policy: |
| 39 | + vm: "{{ cs_resource_prefix }}-vm-snapshot-policy" |
| 40 | + interval_type: hourly |
| 41 | + schedule: 5 |
| 42 | + register: snapshot |
| 43 | +- name: verify create snapshot policy |
| 44 | + assert: |
| 45 | + that: |
| 46 | + - snapshot is changed |
| 47 | + - snapshot.schedule == "5" |
| 48 | + - snapshot.interval_type == "hourly" |
| 49 | + - snapshot.volume != "" |
| 50 | + |
| 51 | +- name: create snapshot policy idempotence |
| 52 | + ngine_io.cloudstack.volume_snapshot_policy: |
| 53 | + vm: "{{ cs_resource_prefix }}-vm-snapshot-policy" |
| 54 | + interval_type: hourly |
| 55 | + schedule: 5 |
| 56 | + register: snapshot |
| 57 | +- name: verify create snapshot policy idempotence |
| 58 | + assert: |
| 59 | + that: |
| 60 | + - snapshot is not changed |
| 61 | + - snapshot.schedule == "5" |
| 62 | + - snapshot.interval_type == "hourly" |
| 63 | + - snapshot.volume != "" |
| 64 | + |
| 65 | +- name: update snapshot policy |
| 66 | + ngine_io.cloudstack.volume_snapshot_policy: |
| 67 | + vm: "{{ cs_resource_prefix }}-vm-snapshot-policy" |
| 68 | + interval_type: hourly |
| 69 | + schedule: 6 |
| 70 | + check_mode: true |
| 71 | + register: snapshot |
| 72 | +- name: verify update snapshot policy |
| 73 | + assert: |
| 74 | + that: |
| 75 | + - snapshot is changed |
| 76 | + - snapshot.schedule == "5" |
| 77 | + - snapshot.interval_type == "hourly" |
| 78 | + - snapshot.volume != "" |
| 79 | + |
| 80 | +- name: update snapshot policy in check mode |
| 81 | + ngine_io.cloudstack.volume_snapshot_policy: |
| 82 | + vm: "{{ cs_resource_prefix }}-vm-snapshot-policy" |
| 83 | + interval_type: hourly |
| 84 | + schedule: 6 |
| 85 | + max_snaps: 3 |
| 86 | + time_zone: "Europe/Zurich" |
| 87 | + check_mode: true |
| 88 | + register: snapshot |
| 89 | +- name: verify update snapshot policy in check mode |
| 90 | + assert: |
| 91 | + that: |
| 92 | + - snapshot is changed |
| 93 | + - snapshot.schedule == "5" |
| 94 | + - snapshot.interval_type == "hourly" |
| 95 | + - snapshot.volume != "" |
| 96 | + - snapshot.max_snaps == 8 |
| 97 | + - snapshot.time_zone == "UTC" |
| 98 | + |
| 99 | +- name: update snapshot policy |
| 100 | + ngine_io.cloudstack.volume_snapshot_policy: |
| 101 | + vm: "{{ cs_resource_prefix }}-vm-snapshot-policy" |
| 102 | + interval_type: hourly |
| 103 | + schedule: 6 |
| 104 | + max_snaps: 3 |
| 105 | + time_zone: "Europe/Zurich" |
| 106 | + register: snapshot |
| 107 | +- name: verify update snapshot policy |
| 108 | + assert: |
| 109 | + that: |
| 110 | + - snapshot is changed |
| 111 | + - snapshot.schedule == "6" |
| 112 | + - snapshot.interval_type == "hourly" |
| 113 | + - snapshot.volume != "" |
| 114 | + - snapshot.max_snaps == 3 |
| 115 | + - snapshot.time_zone == "Europe/Zurich" |
| 116 | + |
| 117 | +- name: update snapshot policy idempotence |
| 118 | + ngine_io.cloudstack.volume_snapshot_policy: |
| 119 | + vm: "{{ cs_resource_prefix }}-vm-snapshot-policy" |
| 120 | + interval_type: hourly |
| 121 | + schedule: 6 |
| 122 | + max_snaps: 3 |
| 123 | + time_zone: "Europe/Zurich" |
| 124 | + register: snapshot |
| 125 | +- name: verify update snapshot policy idempotence |
| 126 | + assert: |
| 127 | + that: |
| 128 | + - snapshot is not changed |
| 129 | + - snapshot.schedule == "6" |
| 130 | + - snapshot.interval_type == "hourly" |
| 131 | + - snapshot.volume != "" |
| 132 | + - snapshot.max_snaps == 3 |
| 133 | + - snapshot.time_zone == "Europe/Zurich" |
| 134 | + |
| 135 | +- name: remove snapshot policy in check mode |
| 136 | + ngine_io.cloudstack.volume_snapshot_policy: |
| 137 | + vm: "{{ cs_resource_prefix }}-vm-snapshot-policy" |
| 138 | + interval_type: hourly |
| 139 | + state: absent |
| 140 | + check_mode: true |
| 141 | + register: snapshot |
| 142 | +- name: verify remove snapshot policy in check mode |
| 143 | + assert: |
| 144 | + that: |
| 145 | + - snapshot is changed |
| 146 | + - snapshot.schedule == "6" |
| 147 | + - snapshot.interval_type == "hourly" |
| 148 | + - snapshot.volume != "" |
| 149 | + - snapshot.max_snaps == 3 |
| 150 | + - snapshot.time_zone == "Europe/Zurich" |
| 151 | + |
| 152 | +- name: remove snapshot policy |
| 153 | + ngine_io.cloudstack.volume_snapshot_policy: |
| 154 | + vm: "{{ cs_resource_prefix }}-vm-snapshot-policy" |
| 155 | + interval_type: hourly |
| 156 | + state: absent |
| 157 | + register: snapshot |
| 158 | +- name: verify remove snapshot policy |
| 159 | + assert: |
| 160 | + that: |
| 161 | + - snapshot is changed |
| 162 | + - snapshot.schedule == "6" |
| 163 | + - snapshot.interval_type == "hourly" |
| 164 | + - snapshot.volume != "" |
| 165 | + - snapshot.max_snaps == 3 |
| 166 | + - snapshot.time_zone == "Europe/Zurich" |
| 167 | + |
| 168 | +- name: remove snapshot policy idempotence |
| 169 | + ngine_io.cloudstack.volume_snapshot_policy: |
| 170 | + vm: "{{ cs_resource_prefix }}-vm-snapshot-policy" |
| 171 | + interval_type: hourly |
| 172 | + state: absent |
| 173 | + register: snapshot |
| 174 | +- name: verify remove snapshot policy idempotence |
| 175 | + assert: |
| 176 | + that: |
| 177 | + - snapshot is not changed |
0 commit comments