cloudera.cloud.cai_workspace lookup – Get the API URL for Cloudera AI Workspace in Cloudera on cloud.

Note

This lookup plugin 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.cai_workspace.

New in cloudera.cloud 3.2.0

Synopsis

  • Allows you to retrieve the API URL for a given Cloudera AI Workspace in Cloudera on cloud.

  • If the Environment is not found, the lookup will return an empty list.

  • If the workspace is not found in the specified Environment, the lookup will return the default value.

Terms

Parameter

Comments

Terms

string / required

The name of the Cloudera AI Workspace or list of workspace names to query.

Returns the API endpoint URL for each workspace.

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

Parameter

Comments

default

any

What to return when the workspace is not found

Default: []

environment

aliases: env

string / required

Name of the Cloudera on cloud Environment where the workspace is deployed

Notes

Note

  • When keyword and positional parameters are used together, positional parameters must be listed before keyword parameters: lookup('cloudera.cloud.cai_workspace', term1, term2, key1=value1, key2=value2) and query('cloudera.cloud.cai_workspace', 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 API URL for a Cloudera AI Workspace
  ansible.builtin.debug:
    msg: "{{ lookup('cloudera.cloud.cai_workspace', 'my-workspace', env='example-env') }}"

- name: Use the workspace API URL in a task
  ansible.builtin.set_fact:
    cai_api: "{{ lookup('cloudera.cloud.cai_workspace', ml_workspace, env=cdp_env) }}"

- name: Return a default value if workspace does not exist
  ansible.builtin.debug:
    msg: "{{ lookup('cloudera.cloud.cai_workspace', 'my-workspace', env='example-env', default='http://default') }}"

- name: Retrieve API URLs for multiple workspaces
  ansible.builtin.debug:
    msg: "{{ query('cloudera.cloud.cai_workspace', 'workspace1', 'workspace2', env='example-env') }}"

- name: Retrieve multiple workspaces specified as a list
  ansible.builtin.debug:
    msg: "{{ query('cloudera.cloud.cai_workspace', ['workspace1', 'workspace2'], env='example-env') }}"

Return Value

Key

Description

Return value

list / elements=string

List of API URLs for the queried Cloudera AI Workspaces

Returned: success

Authors

  • Ronald Suplina (@rsuplina)

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.