Skip to content

Latest commit

 

History

History
241 lines (206 loc) · 8.82 KB

community.missing_collection.docker_hub_personal_token_module.rst

File metadata and controls

241 lines (206 loc) · 8.82 KB

community.missing_collection.docker_hub_personal_token

Management of the Docker Hub Personal Tokens.

Version added: 0.4.0

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

  • requests
Parameter Choices/Defaults Comments
command
string
    Choices:
  • create ←
  • update
  • delete
type of operation on docker hub api.
is_active
boolean
    Choices:
  • no
  • yes ←
enable/disable personal token.
scopes
list
Valid scopes "repo:admin", "repo:write", "repo:read", "repo:public_read"
token
string / required
jwt/bearer token for api.
token_label
string
Friendly name for you to identify the token.
url
string
Default:
docker hub personal token api.
uuid
string
uuid of personal token.
required only for command delete/update.

- name: get jwt token from docker hub
  community.missing_collection.docker_hub_token:
    username: 'testUser'
    password: 'aDL0xxxxxxxxxxoQt6'
  register: '__'

- name: create docker hub personal token
  community.missing_collection.docker_hub_personal_token:
    token: '{{ __.token }}'
    command: 'create'
    token_label: 'Ansible Managed Token'
    scopes:
      - 'repo:admin'
  register: '__created'

- name: update docker hub personal token aka disable it.
  community.missing_collection.docker_hub_personal_token:
    token: '{{ __.token }}'
    command: 'update'
    uuid: '{{ __created.result["uuid"] }}'
    is_active: false

- name: delete docker hub personal token.
  community.missing_collection.docker_hub_personal_token:
    token: '{{ __.token }}'
    command: 'delete'
    uuid: '{{ __created.result["uuid"] }}'

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

Key Returned Description
result
dictionary
when command is create/update and success.
result of docker hub api.

Sample:
{'uuid': 'b30bbf97-506c-4ecd-aabc-842f3cb484fb', 'client_id': 'HUB', 'creator_ip': '127.0.0.1', 'creator_ua': 'some user agent', 'created_at': '2021-07-20T12:00:00.000Z', 'last_used': 'string', 'generated_by': 'manual', 'is_active': True, 'token': 'a7a5ef25-8889-43a0-8cc7-f2a94268e861', 'token_label': 'My read only token', 'scopes': ['repo:read']}


Authors