cloudera.cluster.cluster module – Manage the lifecycle and state of a cluster
Note
This module is part of the cloudera.cluster collection (version 4.4.0).
To install it, use: ansible-galaxy collection install cloudera.cluster
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: cloudera.cluster.cluster
.
Synopsis
Enables cluster management, cluster creation, deletion, and unified control of all services of a cluster.
Create or delete cluster in Cloudera Manager.
Start or stop all services inside the cluster.
If provided the
template
parameter, the module will populate its parameters using the cluster template contents.Any other parameters will merge on top of the parameters declared by the cluster template.
Requirements
The below requirements are needed on the host that executes this module.
cm-client
Parameters
Parameter |
Comments |
---|---|
Flag to add any repositories found in a cluster template should be added to Cloudera Manager. Valid only if template is set. Choices:
|
|
Set the HTTP user agent header when interacting with the CM API endpoint. Default: |
|
Flag enabling the auto-assignment of role in the cluster. This function honors existing or declared assignments. Choices:
|
|
The runtime version of the cluster. |
|
List of data contexts for compute-type clusters. Required if type=COMPUTE_CLUSTER. |
|
Capture the HTTP interaction logs with the CM API endpoint. Choices:
|
|
The name of the cluster in the Cloudera Manager UI. If not set, the name of the cluster will be used. |
|
Flag to force TLS during CM API endpoint discovery. If Choices:
|
|
Hostname of the CM API endpoint. If set, the Mutually exclusive with url. |
|
List of host template definitions for the cluster for use with hosts. |
|
The name of the host template. |
|
List of role groups, base and custom, to associated with the host template. |
|
The name of the custom role group. Mutually exclusive with type. |
|
The name of the service associated with the role group. |
|
The role type of the base role group for the service. Mutually exclusive with name. |
|
List of hosts and their configuration attached to the cluster. |
|
The host configuration values. |
|
The host template to apply to the host. |
|
The hostname or host ID of the host. |
|
List of role groups to associate directly with the host. |
|
The name of the custom role group. Mutually exclusive with type. |
|
The name of the service associated with the role group. |
|
The role type of the base role group for the service. Mutually exclusive with name. |
|
List of per-host role instance configuration overrides. |
|
The role instance override configuration values. |
|
The name of the service of the role instance. |
|
The role type of the role instance. |
|
The tags labeling the host. |
|
Flag enabling the maintenance mode for the cluster. Choices:
|
|
Message to log for any changes to the entity. Default: |
|
The cluster name. |
|
The parcels by version enabled for a cluster. The name of the parcel is the c(key), the version of the parcel is the c(value). |
|
Password for access to the CM API endpoint. This parameter is set to |
|
Port of the CM API endpoint. If set, CM API endpoint discovery will connect to the designated port first and will follow redirects. Default: |
|
Set the HTTP/S proxy server when interacting with the CM API endpoint. |
|
Set all parameters to either their default or declared values. Choices:
|
|
List of services and service configurations to enable for the cluster. |
|
The service configuration values, i.e. the “service-wide” configuration. |
|
The display name of the service in the Cloudera Manager UI. If not set, the name will be used. |
|
The name or reference of the service. If not set, a name for the service will be auto-generated. |
|
List of role configuration groups for a role type of the service. Both base and custom role configuration groups are supported. |
|
The role group configuration values. |
|
The display name of the role group in the Cloudera Manager UI. If not set, the name will be used. |
|
The name of the role group. If not set, the base role group, i.e. the default role group, for the role type is used. |
|
The role type for the role group. |
|
The tags labeling the service. |
|
The type of service to enable. |
|
The version of the service to enable. |
|
Path to SSL CA certificate to use for validation. |
|
The state of the cluster. If state=absent, the cluster’s services will be shut down first, then the cluster deleted. Choices:
|
|
The tags labeling the cluster. |
|
A cluster template file to populate the module parameters, e.g. as a baseline. |
|
Flag enabling TLS for the cluster. Choices:
|
|
The type of cluster. Choices:
|
|
The CM API endpoint URL and should include scheme, host, port, and API root path. Mutually exclusive with host. |
|
Username for access to the CM API endpoint. |
|
Verify the TLS certificates for the CM API endpoint. Choices:
|
|
API version of the CM API endpoint. Default: |
Attributes
Attribute |
Support |
Description |
---|---|---|
Support: full |
Can run in check_mode and return changed status prediction without modifying target |
|
Support: full |
Will return details on what has changed (or possibly needs changing in check_mode), when in diff mode |
|
Platforms: all |
Target OS/families that can be operated against |
Examples
- name: Create a minimal cluster (can be used by other modules to establish services, etc.)
cloudera.cluster.cluster:
host: example.cloudera.com
username: "jane_smith"
password: "S&peR4Ec*re"
port: 7180
cluster_name: example-cluster
cluster_version: "7.1.9"
cluster_type: BASE_CLUSTER
state: present
- name: Start all services on a cluster
cloudera.cluster.cluster:
host: example.cloudera.com
port: "7180"
username: "jane_smith"
password: "S&peR4Ec*re"
name: example-cluster
state: started
- name: Delete a Cluster
cloudera.cluster.cluster:
host: example.cloudera.com
port: "7180"
username: "jane_smith"
password: "S&peR4Ec*re"
name: example-cluster
state: absent
- name: Create a cluster with a direct assignment of a base role group
cloudera.cluster.cluster:
host: example.cloudera.com
port: "7180"
username: "jane_smith"
password: "S&peR4Ec*re"
name: example-host-assignment-base
cluster_version: "7.1.9"
type: BASE_CLUSTER
state: present
services:
- name: ROLE_GROUP_ASSIGNMENT
type: ZOOKEEPER
role_groups:
- type: SERVER
display_name: Server Base Group
config:
zookeeper_server_java_heapsize: 134217728 # 128MB
- name: DIRECT_ROLE_GROUP_ASSIGNMENT
type: SERVER
display_name: Server Custom Group
config:
zookeeper_server_java_heapsize: 33554432 # 32MB
hosts:
- name: worker-02.cldr.internal
role_groups:
- type: SERVER
service: ROLE_GROUP_ASSIGNMENT
- name: Create a cluster with a direct assignment of a custom role group
cloudera.cluster.cluster:
host: example.cloudera.com
port: "7180"
username: "jane_smith"
password: "S&peR4Ec*re"
name: example-host-assignment-custom
cluster_version: "7.1.9"
type: BASE_CLUSTER
state: present
services:
- name: ROLE_GROUP_ASSIGNMENT
type: ZOOKEEPER
role_groups:
- type: SERVER
display_name: Server Base Group
config:
zookeeper_server_java_heapsize: 134217728 # 128MB
- name: DIRECT_ROLE_GROUP_ASSIGNMENT
type: SERVER
display_name: Server Custom Group
config:
zookeeper_server_java_heapsize: 33554432 # 32MB
hosts:
- name: worker-02.cldr.internal
role_groups:
- type: SERVER
name: DIRECT_ROLE_GROUP_ASSIGNMENT
- name: Create a cluster with a per-host override of a role configuration
cloudera.cluster.cluster:
host: example.cloudera.com
port: "7180"
username: "jane_smith"
password: "S&peR4Ec*re"
name: example-host-override
cluster_version: "7.1.9"
type: BASE_CLUSTER
state: present
services:
- name: ZK-EXAMPLE
type: ZOOKEEPER
role_groups:
- name: NON-BASE-SERVER
type: SERVER
display_name: Server Custom Group
config:
zookeeper_server_java_heapsize: 75497472 # 72MB
hosts:
- name: worker-01.cldr.internal
roles:
- service: ZK-EXAMPLE
type: SERVER
config:
zookeeper_server_java_heapsize: 67108864 # 64MB
host_template: Example_Template
host_templates:
- name: Example_Template
role_groups:
- NON-BASE-SERVER
parcels:
CDH: "7.1.9"
- name: Create and establish a minimal base cluster
cloudera.cluster.cluster:
host: example.cloudera.com
port: "7180"
username: "jane_smith"
password: "S&peR4Ec*re"
name: Basic_Cluster
cluster_version: "7.1.9-1.cdh7.1.9.p0.44702451"
type: BASE_CLUSTER
state: started
services:
- name: core-settings-0
type: CORE_SETTINGS
display_name: Core Settings
- name: zookeeper-0
type: ZOOKEEPER
display_name: Zookeeper
config:
zookeeper_datadir_autocreate: yes
- name: hdfs-0
type: HDFS
config:
zookeeper_service: zookeeper-0
core_connector: core-settings-0
role_groups:
- type: DATANODE
config:
dfs_data_dir_list: /dfs/dn
- type: NAMENODE
config:
dfs_name_dir_list: /dfs/nn
- type: SECONDARYNAMENODE
config:
fs_checkpoint_dir_list: /dfs/snn
- name: yarn-0
type: YARN
config:
hdfs_service: hdfs-0
zookeeper_service: zookeeper-0
role_groups:
- type: RESOURCEMANAGER
config:
yarn_scheduler_maximum_allocation_mb: 4096
yarn_scheduler_maximum_allocation_vcores: 4
- type: NODEMANAGER
config:
yarn_nodemanager_resource_memory_mb: 4096
yarn_nodemanager_resource_cpu_vcores: 4
yarn_nodemanager_local_dirs: /tmp/nm
yarn_nodemanager_log_dirs: /var/log/nm
- type: GATEWAY
config:
mapred_submit_replication: 3
mapred_reduce_tasks: 6
host_templates:
- name: Master1
role_groups:
- service: HDFS
type: NAMENODE
- service: HDFS
type: SECONDARYNAMENODE
- service: YARN
type: RESOURCEMANAGER
- service: YARN
type: JOBHISTORY
- name: Worker
role_groups:
- service: HDFS
type: DATANODE
- service: YARN
type: NODEMANAGER
- service: ZOOKEEPER
type: SERVER
parcels:
CDH: "7.1.9-1.cdh7.1.9.p0.44702451"
hosts:
- name: master-01.cldr.internal
host_template: Master1
- name: worker-01.cldr.internal
host_template: Worker
- name: worker-02.cldr.internal
host_template: Worker
- name: worker-03.cldr.internal
host_template: Worker
- name: Create a cluster from a cluster template
cloudera.cluster.cluster:
host: example.cloudera.com
username: "jane_smith"
password: "S&peR4Ec*re"
port: "7180"
name: example-cluster
template: "./files/cluster-template.json"
add_repositories: yes
- name: Create an ECS cluster
cloudera.cluster.cluster:
host: example.cloudera.com
username: "jane_smith"
password: "S&peR4Ec*re"
port: 7180
cluster_name: example-cluster
cluster_version: "1.5.1-b626.p0.42068229"
cluster_type: EXPERIENCE_CLUSTER
state: present
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Details about Cloudera Manager Cluster Returned: success |
|
The type of cluster. Returned: always |
|
The name of the cluster displayed in the Cloudera Manager UI. Returned: always |
|
Health status of the cluster. Returned: always |
|
Maintance mode of cluster. Returned: always |
|
List of maintance owners for cluster. Returned: always |
|
The name of the cluster. Returned: always |
|
List of tags for cluster. Returned: always |
|
The unique ID of the cluster. Returned: always |
|
Version of the cluster installed. Returned: always |
Authors
Ronald Suplina (@rsuplina)
Webster Mudge (@wmudge)
Collection links