Skip to content

Commit 0eb7242

Browse files
committed
Update for DW Cluster ID retrieval
Signed-off-by: Webster Mudge <wmudge@cloudera.com>
1 parent 04c0557 commit 0eb7242

File tree

1 file changed

+10
-40
lines changed

1 file changed

+10
-40
lines changed

roles/runtime/tasks/setup_aws.yml

Lines changed: 10 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
label: "{{ __aws_instance_item.instance_id }}"
3535
loop: "{{ __aws_instance_info.instances }}"
3636

37-
- name: Setup CDP DW cluster on AWS
37+
- name: Setup CDP DW Cluster on AWS
3838
when: run__include_dw
3939
block:
4040
- name: Execute CDP DW cluster setup
@@ -46,41 +46,12 @@
4646
aws_private_subnets: "{{ run__datahub_private_subnet_ids if run__dw_private_worker_nodes else [] }}"
4747
state: present
4848
wait: yes
49-
async: 3600 # 1 hour timeout
50-
poll: 0
5149
register: __dw_builds
5250

53-
- name: Wait for CDP DW cluster setup to complete
54-
when: false
55-
ansible.builtin.async_status:
56-
jid: "{{ __dw_builds.ansible_job_id }}"
57-
register: __dw_builds_async
58-
until: __dw_builds_async.finished
59-
retries: 120
60-
delay: 30
61-
62-
- name: Retrieve CDP DW experiences
63-
cloudera.cloud.dw_cluster_info:
64-
env: "{{ run__env_name }}"
65-
register: run__dw_list
66-
67-
- name: Fetch all the Database Catalogs under the cluster
68-
cloudera.cloud.dw_database_catalog_info:
69-
cluster_id: "{{ run__dw_list.clusters[0].id }}"
70-
register: __dbc_list
71-
72-
- name: Set default Database catalog id for the cluster
73-
when: __dw_dbc.name | regex_search('.*'+run__dw_default_dbc_suffix+'$')
74-
ansible.builtin.set_fact:
75-
__default_dbc_id: "{{ __dw_dbc.id }}"
76-
loop: "{{ __dbc_list.database_catalogs }}"
77-
loop_control:
78-
loop_var: __dw_dbc
79-
80-
- name: Create CDP DW Database catalogs
81-
when: not __dw_dbc_config.use_default_dbc
51+
# TODO Refactor for non-AWS?
52+
- name: Create CDP DW Database Catalogs
8253
cloudera.cloud.dw_database_catalog:
83-
cluster_id : "{{ run__dw_list.clusters[0].id }}"
54+
cluster_id: "{{ __dw_builds.cluster.id }}"
8455
name: "{{ __dw_dbc_config.name }}"
8556
load_demo_data: "{{ __dw_dbc_config.load_demo_data }}"
8657
state: present
@@ -93,8 +64,7 @@
9364
label: "{{ __dw_dbc_config.name }}"
9465
register: __dw_dbc_builds
9566

96-
- name: Wait for CDP DW Database catalogs setup to complete
97-
when: __dw_dbc_build.ansible_job_id is defined
67+
- name: Wait for CDP DW Database Catalogs setup to complete
9868
ansible.builtin.async_status:
9969
jid: "{{ __dw_dbc_build.ansible_job_id }}"
10070
register: __dw_dbc_builds_async
@@ -106,18 +76,19 @@
10676
loop_var: __dw_dbc_build
10777
label: "{{ __dw_dbc_build.__dw_dbc_config.name }}"
10878

109-
- name: Set CDP DW Database catalog name to id map
110-
when: __dw_dbc_build_async.database_catalog is defined
79+
- name: Set CDP DW Database Catalog ID map
11180
ansible.builtin.set_fact:
11281
run__dw_dbc_ids: "{{ run__dw_dbc_ids | default({}) | combine({ __dw_dbc_build_async.database_catalog.name : __dw_dbc_build_async.database_catalog.id}) }}"
11382
loop: "{{ __dw_dbc_builds_async.results }}"
11483
loop_control:
11584
loop_var: __dw_dbc_build_async
85+
label: "{{ __dw_dbc_build_async.database_catalog.name }}"
86+
failed_when: __dw_dbc_build_async.database_catalog is undefined
11687

11788
- name: Create CDP DW Virtual warehouse
11889
cloudera.cloud.dw_virtual_warehouse:
119-
cluster_id: "{{ run__dw_list.clusters[0].id }}"
120-
dbc_id: "{{ __dw_vw_config.use_default_dbc | ternary(__default_dbc_id, run__dw_dbc_ids[__dw_vw_config.dbc_name]) }}"
90+
cluster_id: "{{ __dw_builds.cluster.id }}"
91+
dbc_id: "{{ run__dw_dbc_ids[__dw_vw_config.dbc_name] }}"
12192
type: "{{ __dw_vw_config.type }}"
12293
name: "{{ __dw_vw_config.name }}"
12394
template: "{{ __dw_vw_config.template }}"
@@ -138,7 +109,6 @@
138109
label: "{{ __dw_vw_config.name }}"
139110

140111
- name: Wait for CDP DW Virtual warehouse setup to complete
141-
when: __dw_vw_build.ansible_job_id is defined
142112
ansible.builtin.async_status:
143113
jid: "{{ __dw_vw_build.ansible_job_id }}"
144114
register: __dw_vw_builds_async

0 commit comments

Comments
 (0)