cloudera.cloud.iam_machine_user module – Create, update, or destroy CDP IAM machine users

Note

This module is part of the cloudera.cloud collection (version 3.1.0).

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install cloudera.cloud.

To use it in a playbook, specify: cloudera.cloud.iam_machine_user.

New in cloudera.cloud 3.2.0

Synopsis

  • Create, update, and destroy Cloudera Data Platform IAM machine users.

Parameters

Parameter

Comments

access_key

string

If provided, the Cloudera on cloud API will use this value as its access key.

If not provided, the API will attempt to use the value from the environment variable CDP_ACCESS_KEY_ID.

Required if private_key is provided.

Mutually exclusive with credentials_path.

credentials_path

string

If provided, the Cloudera on cloud API will use this value as its credentials path.

If not provided, the API will attempt to use the value from the environment variable CDP_CREDENTIALS_PATH.

Default: "~/.cdp/credentials"

debug

aliases: debug_endpoints

boolean

If true, the module will capture the Cloudera on cloud HTTP log and return it in the sdk_out and sdk_out_lines fields.

Choices:

  • false ← (default)

  • true

endpoint

aliases: endpoint_url, url

string

The Cloudera on cloud API endpoint to use.

Mutually exclusive with endpoint_region.

endpoint_region

aliases: cdp_endpoint_region, cdp_region, region

string

Specify the Cloudera on cloud API endpoint region.

See Cloudera Control Plane regions for more information.

If not provided, the API will attempt to use the value from the environment variable CDP_REGION.

default is an alias for the us-west-1 region.

Mutually exclusive with endpoint.

Choices:

  • "default"

  • "us-west-1" ← (default)

  • "eu-1"

  • "ap-1"

endpoint_tls

aliases: verify_endpoint_tls, verify_tls, verify_api_tls

boolean

Verify the TLS certificates for the Cloudera on cloud API endpoint.

Choices:

  • false

  • true ← (default)

http_agent

aliases: agent_header

string

The HTTP user agent to use for Cloudera on cloud API requests.

Default: "cloudera.cloud"

name

aliases: machine_user_name

string / required

The name of the machine user.

The name must be unique, must have a maximum of 128 characters, and must contain only alphanumeric characters, “-”, and “_”.

Names are case-sensitive.

private_key

string

If provided, the Cloudera on cloud API will use this value as its private key.

If not provided, the API will attempt to use the value from the environment variable CDP_PRIVATE_KEY.

Required if access_key is provided.

profile

string

If provided, the Cloudera on cloud API will use this value as its profile.

If not provided, the API will attempt to use the value from the environment variable CDP_PROFILE.

Default: "default"

purge

boolean

Flag to replace roles and resource_roles with their specified values.

Choices:

  • false ← (default)

  • true

resource_roles

list / elements=dictionary

A list of resource role assignments.

resource

aliases: resource_crn

string / required

The resource CRN for the rights assignment.

role

aliases: resource_role_crn

string / required

The resource role CRN to be assigned.

roles

list / elements=string

A single role or list of roles assigned to the machine user.

The role must be identified by its full CRN.

state

string

The state of the machine user.

Choices:

  • "present" ← (default)

  • "absent"

strict

aliases: strict_errors

boolean

Legacy CDPy SDK error handling.

Choices:

  • false ← (default)

  • true

Examples

# Note: These examples do not set authentication details.

# Create a machine user
- cloudera.cloud.iam_machine_user:
    name: my-machine-user

# Delete a machine user
- cloudera.cloud.iam_machine_user:
    state: absent
    name: my-machine-user

# Assign roles to a machine user
- cloudera.cloud.iam_machine_user:
    name: my-machine-user
    roles:
      - crn:cdp:iam:us-west-1:altus:role:PowerUser

# Assign resource roles to a machine user
- cloudera.cloud.iam_machine_user:
    name: my-machine-user
    resource_roles:
      - resource: crn:cdp:environments:us-west-1:altus:environment:dev-env
        role: crn:cdp:iam:us-west-1:altus:resourceRole:EnvironmentUser

# Replace resource roles for a machine user
- cloudera.cloud.iam_machine_user:
    name: my-machine-user
    resource_roles:
      - resource: crn:cdp:environments:us-west-1:altus:environment:prod-env
        role: crn:cdp:iam:us-west-1:altus:resourceRole:EnvironmentAdmin
    purge: true

Return Values

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

Key

Description

machine_user

dictionary

The information about the Machine User

Returned: always

creation_date

string

The date when this machine user record was created.

Returned: on success

Sample: "2020-07-06T12:24:05.531000+00:00"

crn

string

The CRN of the machine user.

Returned: on success

machine_user_name

string

The machine user name.

Returned: on success

Sample: "my-machine-user"

resource_assignments

list / elements=dictionary

List of Resource-to-Role assignments that are associated with the machine user.

Returned: on success

resource_crn

string

The CRN of the resource granted the rights of the role.

Returned: on success

resource_role_crn

string

The CRN of the resource role.

Returned: on success

roles

list / elements=string

List of Role CRNs assigned to the machine user.

Returned: on success

status

string

The status of the machine user.

Returned: on success

Sample: "ACTIVE"

workload_username

string

The username used in all the workload clusters of the machine user.

Returned: on success

sdk_out

string

Returns the captured CDP SDK log.

Returned: when supported

sdk_out_lines

list / elements=string

Returns a list of each line of the captured CDP SDK log.

Returned: when supported

Authors

  • Ronald Suplina (@rsuplina)