Skip to content

Commit f98c32d

Browse files
Address review comments
1 parent 3f271b1 commit f98c32d

File tree

4 files changed

+41
-26
lines changed

4 files changed

+41
-26
lines changed

roles/runtime/defaults/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ run__dw_overlay_network: "{{ dw.overlay_network | bool }}"
7272
run__dw_private_load_balancer: "{{ dw.private_load_balancer | default(not run__public_endpoint_access) }}"
7373
run__dw_private_worker_nodes: "{{ dw.private_worker_nodes | bool }}"
7474
run__dw_force_delete: "{{ dw.force_delete | default (run__force_teardown) }}"
75+
run__dw_default_vw_type: "{{ dw.default_vw_type | default('hive') }}"
76+
run__dw_default_template_type: "{{ dw.default_template_type | default('xsmall') }}"
77+
run__dw_default_dbc_suffix: "{{ dw.default_dbc_suffix | default('-dl-default') }}"
7578

7679
run__df_nodes_min: "{{ df.min_k8s_nodes | default(3) }}"
7780
run__df_nodes_max: "{{ df.max_k8s_nodes | default(5) }}"

roles/runtime/tasks/initialize_base.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,10 @@
170170
run__dw_dbc_configs: "{{ run__dw_dbc_configs | default([]) | union([config]) }}"
171171
vars:
172172
include: "{{ lookup('template', __dw_config.include | default('experiences_config_placeholder.j2')) | from_yaml }}"
173-
use_default_dbc: "{{ True if __dw_config.name is not defined else False | bool }}"
174173
config:
175174
name: "{{ __dw_config.name | default('') }}"
176175
load_demo_data: "{{ __dw_config.load_demo_data | default(False) | bool }}"
177-
use_default_dbc: "{{ use_default_dbc }}"
176+
use_default_dbc: "{{ __dw_config.name is undefined | bool }}"
178177
virtual_warehouses: "{{ __dw_config.virtual_warehouses | default([]) }}"
179178
loop: "{{ run__dw_definitions }}"
180179
loop_control:
@@ -186,19 +185,20 @@
186185
run__dw_vw_configs: "{{ run__dw_vw_configs | default([]) | union([config]) }}"
187186
vars:
188187
config:
189-
name: "{{ item.1.name | default([run__namespace, run__dw_vw_suffix ,__dw_dbc_index] | join('-')) }}"
190-
dbc_name: "{{ item.0.name }}"
191-
use_default_dbc: "{{ item.0.use_default_dbc }}"
192-
type: "{{ item.1.type | default('hive') }}"
193-
template: "{{ item.1.template | default('xsmall') }}"
194-
autoscaling_min_nodes: "{{ item.1.autoscaling.min_nodes | default(None) }}"
195-
autoscaling_max_nodes: "{{ item.1.autoscaling.max_nodes | default(None) }}"
196-
common_configs: "{{ item.1.configs.common_configs | default({}) }}"
197-
application_configs: "{{ item.1.configs.application_configs | default({}) }}"
198-
ldap_groups: "{{ item.1.configs.ldap_groups | default(None) }}"
199-
enable_sso: "{{ item.1.configs.enable_sso | default(None) }}"
200-
tags: "{{ item.1.tags | default({}) | combine(run__dw_tags) }}"
188+
name: "{{ __dw_config.1.name | default([run__namespace, run__dw_vw_suffix ,__dw_dbc_index] | join('-')) }}"
189+
dbc_name: "{{ __dw_config.0.name }}"
190+
use_default_dbc: "{{ __dw_config.0.use_default_dbc }}"
191+
type: "{{ __dw_config.1.type | default(run__dw_default_vw_type) }}"
192+
template: "{{ __dw_config.1.template | default(run__dw_default_template_type) }}"
193+
autoscaling_min_nodes: "{{ __dw_config.1.autoscaling.min_nodes | default(None) }}"
194+
autoscaling_max_nodes: "{{ __dw_config.1.autoscaling.max_nodes | default(None) }}"
195+
common_configs: "{{ __dw_config.1.configs.common_configs | default({}) }}"
196+
application_configs: "{{ __dw_config.1.configs.application_configs | default({}) }}"
197+
ldap_groups: "{{ __dw_config.1.configs.ldap_groups | default(None) }}"
198+
enable_sso: "{{ __dw_config.1.configs.enable_sso | default(None) }}"
199+
tags: "{{ __dw_config.1.tags | default({}) | combine(run__dw_tags) }}"
201200
loop: "{{ run__dw_dbc_configs | subelements('virtual_warehouses')}}"
202201
loop_control:
202+
loop_var: __dw_config
203203
index_var: __dw_dbc_index
204-
label: "{{ item.0.name }}"
204+
label: "{{ __dw_config.0.name }}"

roles/runtime/tasks/initialize_setup_aws.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# limitations under the License.
1616

1717
- name: Discover AWS Public and Private VPC Subnets
18-
when: not infra__aws_subnet_ids
18+
when: infra__aws_subnet_ids is undefined
1919
block:
2020
- name: Query AWS Public Subnets
2121
amazon.aws.ec2_vpc_subnet_info:
@@ -49,18 +49,17 @@
4949
label: "{{ __aws_private_subnet_item.subnet_id }}"
5050
loop: "{{ __aws_private_subnets_info.subnets }}"
5151

52-
- name: Assign AWS Private Subnet IDs in not assinged
53-
when: run__datahub_private_subnet_ids is undefined
52+
- name: Set default AWS Private Subnet if there are no Private Subnets
5453
ansible.builtin.set_fact:
55-
run__datahub_private_subnet_ids: "{{ [] }}"
54+
run__datahub_private_subnet_ids: "{{ run__datahub_private_subnet_ids | default([]) }}"
5655

5756
- name: Set fact for AWS Subnet IDs
5857
when: __aws_public_subnets_info is defined or __aws_private_subnets_info is defined
5958
ansible.builtin.set_fact:
60-
run__datahub_subnet_ids: "{{ run__datahub_private_subnet_ids | default([]) | union(run__datahub_public_subnet_ids) }}"
59+
run__datahub_subnet_ids: "{{ run__datahub_private_subnet_ids | union(run__datahub_public_subnet_ids) }}"
6160

6261
- name: Set fact for AWS Subnet IDs by assignment
63-
when: infra__aws_subnet_ids
62+
when: infra__aws_subnet_ids is defined
6463
block:
6564
- name: Set fact for All AWS Subnet IDs by assignment
6665
ansible.builtin.set_fact:

roles/runtime/tasks/setup_aws.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,19 @@
6767
env: "{{ run__env_name }}"
6868
register: run__dw_list
6969

70+
- name: Fetch all the Database Catalogs under the cluster
71+
cloudera.cloud.dw_database_catalog_info:
72+
cluster_id: "{{ run__dw_list.clusters[0].id }}"
73+
register: __dbc_list
74+
75+
- name: Set default Database catalog id for the cluster
76+
when: __dw_dbc.name | regex_search('.*'+run__dw_default_dbc_suffix+'$')
77+
ansible.builtin.set_fact:
78+
__default_dbc_id: "{{ __dw_dbc.id }}"
79+
loop: "{{ __dbc_list.database_catalogs }}"
80+
loop_control:
81+
loop_var: __dw_dbc
82+
7083
- name: Create CDP DW Database catalogs
7184
when: not __dw_dbc_config.use_default_dbc
7285
cloudera.cloud.dw_database_catalog:
@@ -97,22 +110,22 @@
97110
label: "{{ __dw_dbc_build.__dw_dbc_config.name }}"
98111

99112
- name: Set CDP DW Database catalog name to id map
100-
when: __dw_dbc_build_async.database_catalogs is defined
113+
when: __dw_dbc_build_async.database_catalog is defined
101114
ansible.builtin.set_fact:
102-
run__dw_dbc_ids: "{{ run__dw_dbc_ids | default({}) | combine({ __dw_dbc_build_async.database_catalogs[0].name : __dw_dbc_build_async.database_catalogs[0].id}) }}"
115+
run__dw_dbc_ids: "{{ run__dw_dbc_ids | default({}) | combine({ __dw_dbc_build_async.database_catalog.name : __dw_dbc_build_async.database_catalog.id}) }}"
103116
loop: "{{ __dw_dbc_builds_async.results }}"
104117
loop_control:
105118
loop_var: __dw_dbc_build_async
106119

107120
- name: Create CDP DW Virtual warehouse
108121
cloudera.cloud.dw_virtual_warehouse:
109122
cluster_id: "{{ run__dw_list.clusters[0].id }}"
110-
dbc_id: "{{ run__dw_dbc_ids[__dw_vw_config.dbc_name] if not __dw_vw_config.use_default_dbc else run__dw_list.clusters[0].dbcs[0].id}}"
123+
dbc_id: "{{ __dw_vw_config.use_default_dbc | ternary(__default_dbc_id, run__dw_dbc_ids[__dw_vw_config.dbc_name]) }}"
111124
type: "{{ __dw_vw_config.type }}"
112125
name: "{{ __dw_vw_config.name }}"
113126
template: "{{ __dw_vw_config.template }}"
114-
autoscaling_min_nodes: "{{ __dw_vw_config.autoscaling_min_nodes | int }}"
115-
autoscaling_max_nodes: "{{ __dw_vw_config.autoscaling_max_nodes | int }}"
127+
autoscaling_min_nodes: "{{ __dw_vw_config.autoscaling_min_nodes }}"
128+
autoscaling_max_nodes: "{{ __dw_vw_config.autoscaling_max_nodes }}"
116129
common_configs: "{{ __dw_vw_config.common_configs }}"
117130
application_configs: "{{ __dw_vw_config.application_configs }}"
118131
ldap_groups: "{{ __dw_vw_config.ldap_groups }}"

0 commit comments

Comments
 (0)