cloudera.cloud.datalake_service lookup – Get the URL for a CDP Public Cloud Datalake service

Note

This lookup plugin is part of the cloudera.cloud collection (version 2.5.1).

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.datalake_service.

Synopsis

  • Allows you to retrieve the URL for a given CDP Public Cloud Datalake service.

  • If no service name (or optionally Knox service name) is found on the specified Datalake, the lookup returns the value of default.

  • Otherwise, the lookup entry will be an empty list.

  • If the Datalake is not found or is ambigious, the lookup will return an error.

Terms

Parameter

Comments

Terms

string / required

An endpoint serviceName or list of them to lookup within the Datalake.

If knox_service=True, then these values will lookup against the endpoint knoxService.

For example, CM-API, CM-UI, ATLAS_SERVER, and RANGER_ADMIN.

Keyword parameters

This describes keyword parameters of the lookup. These are the values key1=value1, key2=value2 and so on in the following examples: lookup('cloudera.cloud.datalake_service', key1=value1, key2=value2, ...) and query('cloudera.cloud.datalake_service', key1=value1, key2=value2, ...)

Parameter

Comments

datalake

string

Name of the Datalake to query

default

any

What return when the service name is not found on the Datahub

Default: []

environment

string

Name of the Environment of the Datalake to query

knox_service

boolean

Whether the terms are serviceName or knoxService values.

Choices:

  • false ← (default)

  • true

Notes

Note

  • When keyword and positional parameters are used together, positional parameters must be listed before keyword parameters: lookup('cloudera.cloud.datalake_service', term1, term2, key1=value1, key2=value2) and query('cloudera.cloud.datalake_service', term1, term2, key1=value1, key2=value2)

  • You can pass the Undefined object as default to force an undefined error.

  • Requires cdpy.

Examples

- name: Retrieve the details for the Ranger Admin service, via Environment reference
  ansible.builtin.debug:
    msg: "{{ lookup('cloudera.cloud.datalake_service', 'RANGER_ADMIN', environment='example-env', wantlist=True) }}"

- name: Retrieve the details for the Ranger Admin service, via explicit Datalake reference
  ansible.builtin.debug:
    msg: "{{ lookup('cloudera.cloud.datalake_service', 'RANGER_ADMIN', datalake='example-dl', wantlist=True) }}"

- name: Return a generated list if the service does not exist
  ansible.builtin.debug:
    msg: "{{ query('cloudera.cloud.datalake_service', 'NO_SERVICE', environment='example-env', default=['something', 'else']) }}"

- name: Return multiple services from the same Datalake
  ansible.builtin.debug:
    msg: "{{ query('cloudera.cloud.datalake_service', 'RANGER_ADMIN', 'ATLAS_SERVER', 'CM-API', environment='example-env') }}"

- name: Return multiple services, specified as a list
  ansible.builtin.debug:
    msg: "{{ query('cloudera.cloud.datalake_service', ['RANGER_ADMIN', 'ATLAS_SERVER', 'CM-API'], environment='example-env') }}"

- name: Look up via Knox service
  ansible.builtin.debug:
    msg: "{{ query('cloudera.cloud.datalake_service', 'ATLAS_API', environment='example-env', knox_service=True) }}"

Return Value

Key

Description

Return value

list / elements=list

List of lists of service URLs

Returned: success

Authors

  • Webster Mudge (@wmudge)

Hint

Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.