community.general.nomad_token (8.5.0) — module

Manage Nomad ACL tokens

| "added in version" 8.1.0 of community.general"

Authors: Pedro Nascimento (@apecnascimento)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

This module allows to create Bootstrap tokens, create ACL tokens, update ACL tokens, and delete ACL tokens.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create boostrap token
  community.general.nomad_token:
    host: localhost
    token_type: bootstrap
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create ACL token
  community.general.nomad_token:
    host: localhost
    name: "Dev token"
    token_type: client
    policies:
        - readonly
    global_replicated: false
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Update ACL token Dev token
  community.general.nomad_token:
    host: localhost
    name: "Dev token"
    token_type: client
    policies:
        - readonly
        - devpolicy
    global_replicated: false
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete ACL token
  community.general.nomad_token:
    host: localhost
    name: "Dev token"
    state: absent

Inputs

    
host:
    description:
    - FQDN of Nomad server.
    required: true
    type: str

name:
    description:
    - Name of ACL token to create.
    type: str

port:
    default: 4646
    description:
    - Port of Nomad server.
    type: int
    version_added: 8.0.0
    version_added_collection: community.general

state:
    choices:
    - present
    - absent
    description:
    - Create or remove ACL token.
    required: true
    type: str

token:
    description:
    - ACL token for authentication.
    type: str

timeout:
    default: 5
    description:
    - Timeout (in seconds) for the request to Nomad.
    type: int

use_ssl:
    default: true
    description:
    - Use TLS/SSL connection.
    type: bool

policies:
    default: []
    description:
    - A list of the policies assigned to the token.
    elements: str
    type: list

namespace:
    description:
    - Namespace for Nomad.
    type: str

client_key:
    description:
    - Path of certificate's private key for TLS/SSL.
    type: path

token_type:
    choices:
    - client
    - management
    - bootstrap
    default: client
    description:
    - The type of the token can be V(client), V(management), or V(bootstrap).
    type: str

client_cert:
    description:
    - Path of certificate for TLS/SSL.
    type: path

validate_certs:
    default: true
    description:
    - Enable TLS/SSL certificate validation.
    type: bool

global_replicated:
    default: false
    description:
    - Indicates whether or not the token was created with the C(--global).
    type: bool

Outputs

result:
  description: Result returned by nomad.
  returned: always
  sample:
    accessor_id: 0d01c55f-8d63-f832-04ff-1866d4eb594e
    create_index: 14
    create_time: '2023-11-12T18:48:34.248857001Z'
    expiration_time: null
    expiration_ttl: ''
    global: true
    hash: eSn8H8RVqh8As8WQNnC2vlBRqXy6DECogc5umzX0P30=
    modify_index: 836
    name: devs
    policies:
    - readonly
    roles: null
    secret_id: 12e878ab-e1f6-e103-b4c4-3b5173bb4cea
    type: client
  type: dict

See also