cloudera.cluster.cm_resource module – Create, update, and delete resources from the Cloudera Manager API endpoint

Note

This module is part of the cloudera.cluster collection (version 4.3.0).

To install it, use: ansible-galaxy collection install git+https://github.com/cloudera-labs/cloudera.cluster.git. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: cloudera.cluster.cm_resource.

Synopsis

  • Create, update, and delete resources from ad-hoc Cloudera Manager API endpoint paths, i.e. unimplemented API calls.

  • This module only supports the POST, PUT, and DELETE HTTP methods.

  • To retrieve details, i.e. read-only, from ad-hoc/unimplemented API endpoints, use the cloudera.cluster.cm_resource_info module.

  • The module supports check_mode.

Requirements

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

  • cm_client

Parameters

Parameter

Comments

agent_header

string

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

Default: "ClouderaFoundry"

body

dictionary

HTTP body for the CM API endpoint call.

debug

aliases: debug_endpoints

boolean

Capture the HTTP interaction logs with the CM API endpoint.

Choices:

  • false ← (default)

  • true

field

aliases: return_field

string

Field within the response for result extraction.

Use field when the returned object has an enclosing field.

Default: "items"

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.

method

string / required

HTTP method for the CM API endpoint path.

Choices:

  • "DELETE"

  • "POST"

  • "PUT"

password

string / required

Password for access to the CM API endpoint.

This parameter is set to no_log.

path

string / required

Path of the CM API endpoint call.

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

query

aliases: query_parameters, parameters

dictionary

HTTP query parameters for the CM API endpoint call.

ssl_ca_cert

aliases: tls_cert, ssl_cert

path

Path to SSL CA certificate to use for validation.

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

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: tls

string

API version of the CM API endpoint.

Default: "True"

Examples

---
- name: Create a new local Cloudera Manager user
  cloudera.cluster.cm_resource:
    host: example.cloudera.com
    username: "jane_smith"
    password: "S&peR4Ec*re"
    path: "/user"
    method: "POST"
    body:
      items:
        - name: new_user
          password: "Als*$ecU7e"

- name: Update a Cloudera Manager user
  cloudera.cluster.cm_resource:
    host: example.cloudera.com
    username: "jane_smith"
    password: "S&peR4Ec*re"
    path: "/user/existing_user"
    method: "PUT"
    body:
      authRoles:
        - name: "ROLE_LIMITED"

- name: Delete a Cloudera Manager user using a custom SSL certificate
  host: example.cloudera.com
    username: "jane_smith"
    password: "S&peR4Ec*re"
    path: "/user/existing_user"
    ssl_ca_cert: "/path/to/ssl_ca.crt"
    method: "DELETE"

Return Values

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

Key

Description

resources

list / elements=complex

The results from the Cloudera Manager API endpoint call.

If the field is found on the response object, its contents will be returned.

Returned: always


Authors

  • Webster Mudge (@wmudge)

Collection links