zscaler.ziacloud.zia_user_management_department_info module – Gets a list of user departments

Note

This module is part of the zscaler.ziacloud collection (version 2.2.3).

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 zscaler.ziacloud. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: zscaler.ziacloud.zia_user_management_department_info.

New in zscaler.ziacloud 1.0.0

Synopsis

  • Gets a list of departments

Requirements

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

Parameters

Parameter

Comments

api_key

string

A string that contains the obfuscated API key.

client_id

string

The client ID for OAuth2 authentication.

client_secret

string

The client secret for OAuth2 authentication.

cloud

string

The Zscaler cloud name provisioned for your organization.

Choices:

  • "beta"

  • "production"

  • "zscaler"

  • "zscalerbeta"

  • "zscalergov"

  • "zscalerone"

  • "zscalerten"

  • "zscalerthree"

  • "zscalertwo"

  • "zscloud"

  • "zspreview"

id

integer

Department ID.

name

string

Department name.

password

string

A string that contains the password for the API admin.

private_key

string

The private key for JWT-based OAuth2 authentication.

provider

dictionary

A dict containing authentication credentials.

api_key

string

Obfuscated API key.

client_id

string

OAuth2 client ID.

client_secret

string

OAuth2 client secret.

cloud

string

Zscaler cloud name.

Choices:

  • "beta"

  • "production"

  • "zscaler"

  • "zscalerbeta"

  • "zscalergov"

  • "zscalerone"

  • "zscalerten"

  • "zscalerthree"

  • "zscalertwo"

  • "zscloud"

  • "zspreview"

password

string

Password for the API admin.

private_key

string

Private key for OAuth2 JWT.

sandbox_cloud

string

Sandbox Cloud environment.

sandbox_token

string

Sandbox API Key.

use_legacy_client

boolean

Whether to use the legacy Zscaler API client.

Choices:

  • false ← (default)

  • true

username

string

Email ID of the API admin.

vanity_domain

string

Vanity domain for OAuth2.

query

string

An optional JMESPath expression applied locally to the returned list of departments.

Use this for advanced client-side filtering/projection when the name search is not enough.

Applied last, after any id/name selection. See https://jmespath.org/ for the syntax.

Each entry exposes keys such as id, name and comments.

sandbox_cloud

string

The Sandbox cloud environment for API access.

sandbox_token

string

A string that contains the Sandbox API Key.

use_legacy_client

boolean

Whether to use the legacy Zscaler API client.

Choices:

  • false ← (default)

  • true

username

string

A string that contains the email ID of the API admin.

vanity_domain

string

The vanity domain provisioned by Zscaler for OAuth2 flows.

Notes

Note

  • Check mode is not supported.

  • query (JMESPath) is applied locally, after any id/name selection, to the returned list of departments.

Examples

- name: Gets a list of all departments
  zscaler.ziacloud.zia_user_management_department_info:
    provider: '{{ provider }}'

- name: Gets a list of a single department
  zscaler.ziacloud.zia_user_management_department_info:
    provider: '{{ provider }}'
    name: "marketing"

- name: Get departments whose name starts with 'A' (JMESPath)
  zscaler.ziacloud.zia_user_management_department_info:
    provider: '{{ provider }}'
    query: "[?starts_with(name, 'A')]"

- name: Return only the department names (JMESPath projection)
  zscaler.ziacloud.zia_user_management_department_info:
    provider: '{{ provider }}'
    query: "[*].name"

Return Values

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

Key

Description

departments

list / elements=dictionary

List of departments retrieved by the module.

Returned: always

Sample: [{"comments": "A000", "id": 99364434, "name": "A000"}]

comments

string

Additional comments or metadata associated with the department.

Returned: success

Sample: "A000"

id

integer

The unique identifier for the department.

Returned: success

Sample: 99364434

name

string

The name of the department.

Returned: success

Sample: "A000"

Authors

  • William Guilherme (@willguibr)