herve4m.quay.quay_tag (1.2.0) — module

Manage Quay Container Registry image tags

| "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, delete, and update image tags.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure the latest tag is associated with the image that has tag v1.0.0
  herve4m.quay.quay_tag:
    image: production/smallimage:v1.0.0
    tag: latest
    state: present
    quay_host: https://quay.example.com
    quay_token: vgfH9zH5q6eV16Con7SvDQYSr0KPYQimMHVehZv7
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure tag v0.0.2 is associated to the image with the specified digest
  herve4m.quay.quay_tag:
    image: production/smallimage@sha256:4f6f...e797
    tag: v0.0.2
    state: present
    quay_host: https://quay.example.com
    quay_token: vgfH9zH5q6eV16Con7SvDQYSr0KPYQimMHVehZv7
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure tag v0.0.8 expires May 25, 2023 at 16:30
  herve4m.quay.quay_tag:
    image: production/smallimage:v0.0.8
    expiration: 202305251630.00
    state: present
    quay_host: https://quay.example.com
    quay_token: vgfH9zH5q6eV16Con7SvDQYSr0KPYQimMHVehZv7
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure tag v0.0.8 does not expire anymore
  herve4m.quay.quay_tag:
    image: production/smallimage:v0.0.8
    expiration: ""
    state: present
    quay_host: https://quay.example.com
    quay_token: vgfH9zH5q6eV16Con7SvDQYSr0KPYQimMHVehZv7
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure tag v0.0.1 does not exist
  herve4m.quay.quay_tag:
    image: production/smallimage:v0.0.1
    state: absent
    quay_host: https://quay.example.com
    quay_token: vgfH9zH5q6eV16Con7SvDQYSr0KPYQimMHVehZv7

Inputs

    
tag:
    description:
    - When C(state=present), the I(tag) parameter provides the new tag to add to the image.
      If another image already uses that tag, then the module removes the tag from that
      other image first.
    - When C(state=absent), the I(tag) parameter indicates the tag to remove. If you do
      not set that I(tag) parameter, then the module removes the tag that you give in
      the image name with the I(image) parameter.
    - When you specify the image by its digest, in the I(image) parameter, then that I(tag)
      parameter is mandatory.
    type: str

image:
    description:
    - Name of the existing image. The format is C(namespace)/C(repository):C(tag) or C(namespace)/C(repository)@C(digest).
      The namespace can be an organization or a personal namespace.
    - If you omit the namespace part, then the module looks for the repository in your
      personal namespace.
    - If you omit the tag and the digest part, then C(latest) is assumed.
    required: true
    type: str

state:
    choices:
    - absent
    - present
    default: present
    description:
    - If C(absent), then the module deletes the image which tag is given in the I(tag)
      parameter, or if not set, in the image name.
    - If C(present), then the module adds the tag in the I(tag) parameter to the image.
    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

expiration:
    description:
    - Expiration date and time for the tag. The format is C(YYYYMMDDHHMM.SS) but you can
      change it by setting the I(expiration_format) parameter.
    - You cannot set an expiration date more that two years in the future. If you do so,
      then Quay forces the date at that two years boundary.
    - You cannot set an expiration date in the past.
    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

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

expiration_format:
    default: '%Y%m%d%H%M.%S'
    description:
    - Indicate the time format used in the I(expiration) parameter.
    - Based on default Python format (see U(https://docs.python.org/3/library/time.html#time.strftime)).
    type: str