everpure.flasharray.purefa_token module – Create or delete an API token for an existing admin user

Note

This module is part of the everpure.flasharray collection (version 1.46.0).

You might already have this collection installed if you are using the ansible package. 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 everpure.flasharray.

To use it in a playbook, specify: everpure.flasharray.purefa_token.

New in everpure.flasharray 1.0.0

Synopsis

  • Create or delete an API token for an existing admin user.

  • Uses username/password to create/delete the API token.

  • Logging in with a username and password creates the user’s API token when none exists yet, so by the time the module inspects the user the token is always present. state=present therefore returns the token and reports no change; it cannot tell a token created by this run from one that already existed.

  • Use recreate=true to force a new token. This always reports a change.

  • timeout gives the new token a lifetime. The array only accepts a lifetime when the token is created, so a timeout replaces the existing token on every run and always reports a change, exactly like recreate.

  • state=absent deletes the token and reports a change.

Parameters

Parameter

Comments

disable_warnings

boolean

added in everpure.flasharray 1.31.0

Disable insecure certificate warnings in debug logs

Choices:

  • false ← (default)

  • true

fa_url

string

FlashArray management IPv4 address or Hostname.

password

string

Password of the admin user to create API token for.

recreate

boolean

Recreates the API token, overwriting the existing API token if present.

This is the only way to be sure of a new token and is always reported as a change.

Choices:

  • false ← (default)

  • true

state

string

Create or delete API token

The module logs in with the user’s own username and password, and that login creates the user’s API token when none exists, so absent finds a token to delete on every run and always reports a change.

Choices:

  • "present" ← (default)

  • "absent"

timeout

string

The duration of API token validity.

Valid values are weeks (w), days(d), hours(h), minutes(m) and seconds(s).

Only used with state=present. The existing token is deleted and a new one created with this lifetime, so this is always a change.

Requires Purity 6.x, where the REST 1.x apitoken endpoint accepts a token lifetime.

username

string

Username of the admin user to create API token for

Examples

- name: Create API token with no expiration
  purefa_token:
    username: pureuser
    password: secret
    state: present
    fa_url: 10.10.10.2
- name: Create API token with 23 days expiration
  purefa_token:
    username: pureuser
    password: secret
    state: present
    timeout: 23d
    fa_url: 10.10.10.2
- name: Delete API token
  purefa_token:
    username: pureuser
    password: secret
    state: absent
    fa_url: 10.10.10.2

Return Values

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

Key

Description

purefa_token

string

API token for user

Returned: when state=present, whether or not the module reports a change

Sample: "e649f439-49be-3806-f774-a35cbbc4c2d2"

Authors

  • Everpure Ansible Team (@sdodsley)