cloudera.cluster.service_role module – Manage a service role in 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.service_role.

Synopsis

  • Manage a service role in a cluster.

Requirements

The below requirements are needed on the host that executes this module.

  • cm-client

Parameters

Parameter

Comments

agent_header

aliases: user_agent

string

Set the HTTP user agent header when interacting with the CM API endpoint.

Default: "ClouderaFoundry"

cluster

aliases: cluster_name

string / required

The associated cluster.

cluster_host_id

string

The host ID of a cluster instance for the role.

Mutually exclusive with cluster_hostname.

cluster_hostname

aliases: cluster_host

string

The hostname of a cluster instance for the role.

Mutually exclusive with cluster_host_id.

debug

aliases: debug_endpoints

boolean

Capture the HTTP interaction logs with the CM API endpoint.

Choices:

  • false ← (default)

  • true

force_tls

boolean

Flag to force TLS during CM API endpoint discovery.

If False, discovery will first try HTTP and follow any redirects.

Choices:

  • false ← (default)

  • true

host

aliases: hostname

string

Hostname of the CM API endpoint.

If set, the host parameter will trigger CM API endpoint discovery, which will follow redirects.

Mutually exclusive with url.

maintenance

aliases: maintenance_mode

boolean

Flag for whether the role should be in maintenance mode.

Choices:

  • false

  • true

password

string / required

Password for access to the CM API endpoint.

This parameter is set to no_log.

port

integer

Port of the CM API endpoint.

If set, CM API endpoint discovery will connect to the designated port first and will follow redirects.

Default: 7180

proxy_server

aliases: proxy, http_proxy

string

Set the HTTP/S proxy server when interacting with the CM API endpoint.

purge

boolean

Flag for whether the declared role tags should append or overwrite any existing tags.

To clear all tags, set tags={}, i.e. an empty dictionary, and purge=True.

Choices:

  • false ← (default)

  • true

role

aliases: role_name, name

string

The role name.

If not specified, the role name will be auto-generated on creation.

service

aliases: service_name

string / required

The associated service.

ssl_ca_cert

aliases: tls_cert, ssl_cert

path

Path to SSL CA certificate to use for validation.

state

string

The state of the role.

Note, if the declared state is invalid for the role, for example, the role is a HDFS GATEWAY, the module will return an error.

Choices:

  • "present" ← (default)

  • "absent"

  • "restarted"

  • "started"

  • "stopped"

tags

dictionary

A set of tags applied to the role.

To unset a tag, use None as its value.

type

aliases: role_type

string

A role type for the role.

Required if the state creates a new role.

url

aliases: endpoint, cm_endpoint_url

string

The CM API endpoint URL and should include scheme, host, port, and API root path.

Mutually exclusive with host.

username

aliases: user

string / required

Username for access to the CM API endpoint.

verify_tls

boolean

Verify the TLS certificates for the CM API endpoint.

Choices:

  • false

  • true ← (default)

version

aliases: api_version

string

API version of the CM API endpoint.

Default: "True"

Attributes

Attribute

Support

Description

check_mode

Support: full

Can run in check_mode and return changed status prediction without modifying target

diff_mode

Support: full

Will return details on what has changed (or possibly needs changing in check_mode), when in diff mode

platform

Platforms: all

Target OS/families that can be operated against

Examples

---
- name: Establish a service role (auto-generated name)
  cloudera.cluster.service_role:
    host: example.cloudera.com
    username: "jane_smith"
    password: "S&peR4Ec*re"
    cluster: example-cluster
    service: example-hdfs
    type: GATEWAY
    cluster_hostname: worker-01.cloudera.internal

- name: Establish a service role (defined name)
  cloudera.cluster.service_role:
    host: example.cloudera.com
    username: "jane_smith"
    password: "S&peR4Ec*re"
    cluster: example-cluster
    service: example-hdfs
    type: GATEWAY
    name: example-gateway
    cluster_hostname: worker-01.cloudera.internal

- name: Set a service role to maintenance mode
  cloudera.cluster.service_role:
    host: example.cloudera.com
    username: "jane_smith"
    password: "S&peR4Ec*re"
    cluster: example-cluster
    service: example-hdfs
    name: example-gateway
    maintenance: yes

- name: Update (append) tags to a service role
  cloudera.cluster.service_role:
    host: example.cloudera.com
    username: "jane_smith"
    password: "S&peR4Ec*re"
    cluster: example-cluster
    service: example-hdfs
    name: example-gateway
    tags:
      tag_one: value_one
      tag_two: value_two

- name: Set (purge) tags to a service role
  cloudera.cluster.service_role:
    host: example.cloudera.com
    username: "jane_smith"
    cluster: example-cluster
    service: example-hdfs
    name: example-gateway
    tags:
      tag_three: value_three
    purge: yes

- name: Remove all tags on a service role
  cloudera.cluster.service_role:
    host: example.cloudera.com
    username: "jane_smith"
    password: "S&peR4Ec*re"
    cluster: example-cluster
    service: example-hdfs
    name: example-gateway
    tags: {}
    purge: yes

- name: Start a service role
  cloudera.cluster.service_role:
    host: example.cloudera.com
    username: "jane_smith"
    password: "S&peR4Ec*re"
    cluster: example-cluster
    service: example-hdfs
    name: example-gateway
    state: started

- name: Force a restart to a service role
  cloudera.cluster.service_role:
    host: example.cloudera.com
    username: "jane_smith"
    password: "S&peR4Ec*re"
    cluster: example-cluster
    service: example-hdfs
    name: example-gateway
    state: restarted

- name: Start a service role
  cloudera.cluster.service_role:
    host: example.cloudera.com
    username: "jane_smith"
    password: "S&peR4Ec*re"
    cluster: example-cluster
    service: example-hdfs
    name: example-gateway
    state: started

- name: Remove a service role
  cloudera.cluster.service_role:
    host: example.cloudera.com
    username: "jane_smith"
    password: "S&peR4Ec*re"
    cluster: example-cluster
    service: example-hdfs
    name: example-gateway
    state: absent

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

role

dictionary

Details about the service role.

Returned: success

commission_state

string

Commission state of the cluster service role.

Returned: always

config_staleness_status

string

Status of configuration staleness for the cluster service role.

Returned: always

Sample: "['FRESH', 'STALE_REFRESHABLE', 'STALE']"

health_checks

list / elements=dictionary

Lists all available health checks for cluster service role.

Returned: when supported

explanation

string

The explanation of this health check.

Returned: when supported

name

string

Unique name of this health check.

Returned: always

summary

string

The high-level health status of the health check.

Returned: always

Sample: "['DISABLED', 'HISTORY_NOT_AVAILABLE', 'NOT_AVAILABLE', 'GOOD', 'CONCERNING', 'BAD']"

suppressed

boolean

Whether this health check is suppressed.

A suppressed health check is not considered when computing the role’s overall health.

Returned: when supported

health_summary

string

The high-level health status of the cluster service role.

Returned: always

Sample: "['DISABLED', 'HISTORY_NOT_AVAILABLE', 'NOT_AVAILABLE', 'GOOD', 'CONCERNING', 'BAD']"

host_id

string

The unique ID of the cluster host.

Returned: always

maintenance_mode

boolean

Whether the cluster service role is in maintenance mode.

Returned: when supported

maintenance_owners

list / elements=string

The list of objects that trigger this service to be in maintenance mode.

Returned: when supported

Sample: ["CLUSTER", "SERVICE", "ROLE", "HOST", "CONTROL_PLANE"]

name

string

The cluster service role name.

Returned: always

role_config_group_name

string

The name of the cluster service role config group, which uniquely identifies it in a Cloudera Manager installation.

Returned: when supported

role_state

string

State of the cluster service role.

Returned: always

Sample: "['HISTORY_NOT_AVAILABLE', 'UNKNOWN', 'STARTING', 'STARTED', 'STOPPING', 'STOPPED', 'NA']"

service_name

string

The name of the cluster service, which uniquely identifies it in a cluster.

Returned: always

tags

dictionary

The dictionary of tags for the cluster service role.

Returned: when supported

type

string

The cluster service role type.

Returned: always

Sample: "['NAMENODE', 'DATANODE', 'TASKTRACKER']"

zoo_keeper_server_mode

string

The Zookeeper server mode for this cluster service role.

Note that for non-Zookeeper Server roles, this will be null.

Returned: when supported


Authors

  • Webster Mudge (@wmudge)

Collection links