herve4m.quay.quay_robot (1.2.0) — module

Manage Quay Container Registry robot accounts

| "added in version" 0.0.1 of herve4m.quay"

Authors: Herve Quatremain (@herve4m)

Install collection

Install with ansible-galaxy collection install herve4m.quay:==1.2.0


Add to requirements.yml

  collections:
    - name: herve4m.quay
      version: 1.2.0

Description

Create and delete robot accounts.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure the robot account production+robotprod1 exists
  herve4m.quay.quay_robot:
    name: production+robotprod1
    description: Robot account for production
    state: present
    quay_host: https://quay.example.com
    quay_token: vgfH9zH5q6eV16Con7SvDQYSr0KPYQimMHVehZv7
  register: robot_details
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- debug:
    msg: "Robot token: {{ robot_details['token'] }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure the robot account myrobot exists in my namespace
  herve4m.quay.quay_robot:
    name: myrobot
    state: present
    quay_host: https://quay.example.com
    quay_token: vgfH9zH5q6eV16Con7SvDQYSr0KPYQimMHVehZv7
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure the robot account production+robotdev1 does not exists
  herve4m.quay.quay_robot:
    name: production+robotdev1
    state: absent
    quay_host: https://quay.example.com
    quay_token: vgfH9zH5q6eV16Con7SvDQYSr0KPYQimMHVehZv7

Inputs

    
name:
    description:
    - Name of the robot account to create or remove, in the format C(namespace)+C(shortname).
      The namespace can be an organization or a personal namespace.
    - The short name (the part after the C(+) sign) must be in lowercase, must not contain
      white spaces, must not start by a digit, and must be at least two characters long.
    - If you omit the namespace part in the name, then the module uses your personal namespace.
    - You can create and delete robot accounts in your personal namespace, but not in
      the personal namespace of other users. The token you use in I(quay_token) determines
      the user account you are using.
    required: true
    type: str

state:
    choices:
    - absent
    - present
    default: present
    description:
    - If C(absent), then the module deletes the robot account.
    - The module does not fail if the account does not exist, because the state is already
      as expected.
    - If C(present), then the module creates the robot account if it does not already
      exist.
    type: str

quay_host:
    default: http://127.0.0.1
    description:
    - URL for accessing the API. U(https://quay.example.com:8443) for example.
    - If you do not set the parameter, then the module uses the C(QUAY_HOST) environment
      variable.
    - If you do no set the environment variable either, then the module uses the U(http://127.0.0.1)
      URL.
    type: str

quay_token:
    description:
    - OAuth access token for authenticating against the API.
    - If you do not set the parameter, then the module tries the C(QUAY_TOKEN) environment
      variable.
    - Mutually exclusive with I(quay_username) and I(quay_password).
    type: str

description:
    description:
    - Description of the robot account. You cannot update the description of existing
      robot accounts.
    type: str

quay_password:
    description:
    - The password to use for authenticating against the API.
    - If you do not set the parameter, then the module tries the C(QUAY_PASSWORD) environment
      variable.
    - If you set I(quay_password), then you also need to set I(quay_username).
    - Mutually exclusive with I(quay_token).
    type: str

quay_username:
    description:
    - The username to use for authenticating against the API.
    - If you do not set the parameter, then the module tries the C(QUAY_USERNAME) environment
      variable.
    - If you set I(quay_username), then you also need to set I(quay_password).
    - Mutually exclusive with I(quay_token).
    type: str

validate_certs:
    aliases:
    - verify_ssl
    default: true
    description:
    - Whether to allow insecure connections to the API.
    - If C(no), then the module does not validate SSL certificates.
    - If you do not set the parameter, then the module tries the C(QUAY_VERIFY_SSL) environment
      variable (C(yes), C(1), and C(True) mean yes, and C(no), C(0), C(False), and no
      value mean no).
    type: bool

Outputs

name:
  description: Token name.
  returned: changed
  sample: production+robotprod1
  type: str
token:
  description: Robot credential (token).
  returned: changed
  sample: IWG3K5EW92KZLPP42PMOKM5CJ2DEAQMSCU33A35NR7MNL21004NKVP3BECOWSQP2
  type: str