cloudera.cloud.datahub_service lookup – Get the URL for a CDP Public Cloud Datahub 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.datahub_service.

Synopsis

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

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

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

  • If the Datahub 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 Datahub.

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

For example, CM-API, CM-UI, RESOURCEMANAGER, IMPALAD, STREAMING_SQL_ENGINE, and NIFI_REGISTRY_SERVER.

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.datahub_service', key1=value1, key2=value2, ...) and query('cloudera.cloud.datahub_service', key1=value1, key2=value2, ...)

Parameter

Comments

datahub

string / required

Name of the Datahub to query

default

any

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

Default: []

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.datahub_service', term1, term2, key1=value1, key2=value2) and query('cloudera.cloud.datahub_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 NiFi Registry REST service API
  ansible.builtin.debug:
    msg: "{{ lookup('cloudera.cloud.datahub_service', 'NIFI_REGISTRY_SERVER', datahub='example-datahub', wantlist=True) }}"

- name: Return a generated list if the service does not exist
  ansible.builtin.debug:
    msg: "{{ query('cloudera.cloud.datahub_service', 'STREAMS_MESSAGING_MANAGER_SERVER', datahub='non-smm-datahub', default=['something']) }}"

- name: Return multiple services from the same Datahub
  ansible.builtin.debug:
    msg: "{{ query('cloudera.cloud.datahub_service', 'STREAMS_MESSAGING_MANAGER_SERVER', 'CM-API', datahub='example-datahub') }}"

- name: Return multiple services, specified as a list
  ansible.builtin.debug:
    msg: "{{ query('cloudera.cloud.datahub_service', ['STREAMS_MESSAGING_MANAGER_SERVER', 'CM-API'], datahub='example-datahub') }}"

- name: Look up via Knox service
  ansible.builtin.debug:
    msg: "{{ query('cloudera.cloud.datahub_service', 'NIFI_REST', datahub='example-datahub', 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.