Skip to content

Commit 905661c

Browse files
authored
Allow selection of cluster deployed from cluster.yml (#151)
Allows finer-grain control on exactly which type cluster to deploy from a cluster.yml file. The default/legacy behavior remains; all clusters are created as found in a cluster.yml file. To invoke, provide the extra variable "deploy_only", e.g. "-e deploy_only=<value>", at the in command line or in a configuration. Current accepted values: - base - encryption (a KTS cluster) - compute - ecs Thanks npopa@cloudera.com Signed-off-by: Chuck Levesque <clevesque@cloudera.com>
1 parent d25a610 commit 905661c

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

roles/deployment/cluster/tasks/main.yml

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2023 Cloudera, Inc. All Rights Reserved.
1+
# Copyright 2023 Cloudera, Inc.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -18,6 +18,16 @@
1818
name: cloudera.cluster.config.cluster.common
1919
public: yes
2020

21+
## Nico
22+
- name: Apply "all hosts" configs
23+
include_role:
24+
name: cloudera.cluster.cloudera_manager.config
25+
vars:
26+
api_config_keys_uppercase: False
27+
api_config_endpoint: cm/allHosts/config
28+
api_configs: "{{ definition.hosts.configs }}"
29+
when: definition.hosts.configs is defined
30+
2131
- name: Detect Cloudera Manager version
2232
cloudera.cluster.cm_api:
2333
endpoint: /cm/version
@@ -35,6 +45,7 @@
3545
existing_clusters: "{{ clusters_response.json | json_query('items[*].name') }}"
3646

3747
# If you get failures here check in CM to ensure you don't have empty clusters or other oddities
48+
# Add deploy_only="base" to select base from several clusters in clusters.yml
3849
- name: Create base clusters
3950
include_tasks: create_base.yml
4051
loop: "{{ definition.clusters }}"
@@ -45,7 +56,9 @@
4556
when:
4657
- cluster.type | default(default_cluster_type) == 'base'
4758
- cluster.name not in existing_clusters
48-
59+
- (deploy_only is defined and 'base' in deploy_only) or deploy_only is not defined
60+
61+
# Add deploy_only="base" to select base from several clusters in clusters.yml
4962
- name: Update base clusters
5063
include_tasks: update_base.yml
5164
loop: "{{ definition.clusters }}"
@@ -57,7 +70,9 @@
5770
- cluster.type | default(default_cluster_type) == 'base'
5871
- cluster.name in existing_clusters
5972
- (cdh_cdp_upgrade|default(false)|bool) or (update_services|default(false)|bool) or (upgrade_runtime|default(false)|bool)
73+
- (deploy_only is defined and 'base' in deploy_only) or deploy_only is not defined
6074

75+
# Add deploy_only="base" to select base from several clusters in clusters.yml
6176
- name: Create base cluster data contexts (SDX)
6277
include_tasks: create_data_context.yml
6378
loop: "{{ definition.clusters }}"
@@ -68,7 +83,9 @@
6883
when:
6984
- cluster.type | default(default_cluster_type) == 'base'
7085
- cloudera_manager_version is version('6.2.0','>=')
86+
- (deploy_only is defined and 'base' in deploy_only) or deploy_only is not defined
7187

88+
# Add deploy_only="encryption" to select kts from several clusters in clusters.yml
7289
- name: Create Key Trustee server cluster
7390
include_tasks: create_kts.yml
7491
loop: "{{ definition.clusters }}"
@@ -80,7 +97,10 @@
8097
- cluster.type | default(default_cluster_type) == 'kts'
8198
- cluster.name not in existing_clusters
8299
- '"kts_active" in groups'
100+
- (deploy_only is defined and 'encryption' in deploy_only) or deploy_only is not defined
101+
83102

103+
# Add deploy_only="encryption" to select kts from several clusters in clusters.yml
84104
- name: Upgrade Key Trustee server cluster
85105
include_tasks: upgrade_kts.yml
86106
loop: "{{ definition.clusters }}"
@@ -93,7 +113,9 @@
93113
- cluster.name in existing_clusters
94114
- '"kts_active" in groups'
95115
- upgrade_kts_cluster | default(false)
96-
116+
- (deploy_only is defined and 'encryption' in deploy_only) or deploy_only is not defined
117+
118+
# Add deploy_only="compute" to select compute clust from several clusters in clusters.yml
97119
- name: Create compute clusters
98120
include_tasks: create_base.yml
99121
loop: "{{ definition.clusters }}"
@@ -104,8 +126,10 @@
104126
when:
105127
- cluster.type | default(default_cluster_type) == 'compute'
106128
- cluster.name not in existing_clusters
129+
- (deploy_only is defined and 'compute' in deploy_only) or deploy_only is not defined
107130

108131
# This process is not idempotent, as the whole ECS setup process must succeed or it will skip on subsequent runs
132+
# Add deploy_only="ecs" to select ecs from several clusters in clusters.yml
109133
- name: Create ECS clusters
110134
include_tasks: create_ecs.yml
111135
loop: "{{ definition.clusters }}"
@@ -116,8 +140,9 @@
116140
when:
117141
- cluster.type | default(default_cluster_type) == 'ecs'
118142
- cluster.name not in existing_clusters
143+
- (deploy_only is defined and 'ecs' in deploy_only) or deploy_only is not defined
119144

120145
- name: Restart Cloudera Management Service
121146
cloudera.cluster.cm_api:
122147
endpoint: /cm/service/commands/restart
123-
method: POST
148+
method: POST

0 commit comments

Comments
 (0)