|
| 1 | +--- |
| 2 | + |
| 3 | +# Copyright 2023 Cloudera, Inc. All Rights Reserved. |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | + |
| 17 | +- name: Describe multi-AZ Datalake |
| 18 | + cloudera.cloud.datalake_info: |
| 19 | + name: "{{ datalake_multi_az }}" |
| 20 | + register: __dl |
| 21 | + |
| 22 | +- name: Test for multi-AZ Datalake existence |
| 23 | + ansible.builtin.assert: |
| 24 | + that: __dl.datalakes | length == 0 |
| 25 | + fail_msg: "Test Datalake already exists: {{ datalake_multi_az }}" |
| 26 | + |
| 27 | +- name: Construct an AWS multi-AZ Datalake |
| 28 | + when: network.type == "aws" |
| 29 | + cloudera.cloud.datalake: |
| 30 | + name: "{{ datalake_multi_az }}" |
| 31 | + environment: "{{ environment_multi_az }}" |
| 32 | + instance_profile: "{{ identity.idbroker_role }}" |
| 33 | + storage: "{{ storage.datalake_location }}" |
| 34 | + multi_az: true |
| 35 | + register: __dl |
| 36 | + |
| 37 | +- name: Test for multi-AZ Datalake creation |
| 38 | + ansible.builtin.assert: |
| 39 | + that: |
| 40 | + - __dl.datalake | length > 0 |
| 41 | + - __dl.datalake.cloudPlatform == (network.type | upper) |
| 42 | + - __dl.datalake.datalakeName == datalake_multi_az |
| 43 | + |
| 44 | +- name: Test idempotent creation of an AWS multi-AZ Datalake |
| 45 | + when: network.type == "aws" |
| 46 | + cloudera.cloud.datalake: |
| 47 | + name: "{{ datalake_multi_az }}" |
| 48 | + environment: "{{ environment_multi_az }}" |
| 49 | + instance_profile: "{{ identity.idbroker_role }}" |
| 50 | + storage: "{{ storage.datalake_location }}" |
| 51 | + multi_az: true |
| 52 | + register: __dl_idempotent |
| 53 | + |
| 54 | +- name: Test for multi-AZ Datalake idempotent state |
| 55 | + ansible.builtin.assert: |
| 56 | + that: |
| 57 | + - __dl_idempotent.datalake | length > 0 |
| 58 | + - __dl.datalake.crn == __dl_idempotent.datalake.crn |
| 59 | + - not __dl_idempotent.changed |
| 60 | + |
| 61 | +- name: Destroy multi-AZ Datalake |
| 62 | + cloudera.cloud.datalake: |
| 63 | + name: "{{ datalake_multi_az }}" |
| 64 | + state: absent |
| 65 | + register: __dl |
| 66 | + |
| 67 | +- name: Test for multi-AZ Datalake destruction return value |
| 68 | + ansible.builtin.assert: |
| 69 | + that: not __dl.datalake |
| 70 | + |
| 71 | +- name: Describe multi-AZ Datalake after destruction |
| 72 | + cloudera.cloud.datalake_info: |
| 73 | + name: "{{ datalake_multi_az }}" |
| 74 | + register: __dl |
| 75 | + |
| 76 | +- name: Test for multi-AZ Datalake existence |
| 77 | + ansible.builtin.assert: |
| 78 | + that: __dl.datalakes | length == 0 |
0 commit comments