herve4m.quay.quay_manifest_label (1.2.0) — module

Manage Quay Container Registry image manifest labels

| "added in version" 0.0.10 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

Add or remove labels to image manifests.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure the manifest has the architecture label set
  herve4m.quay.quay_manifest_label:
    image: production/smallimage:v1.0.0
    key: architecture
    value: x86_64
    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 manifest has an additional architecture label set
  herve4m.quay.quay_manifest_label:
    image: production/smallimage:v1.0.0
    key: architecture
    value: power
    replace: false
    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 manifest has a specific component label removed
  herve4m.quay.quay_manifest_label:
    image: production/smallimage@sha256:4f6f...e797
    key: component
    value: front
    state: absent
    quay_host: https://quay.example.com
    quay_token: vgfH9zH5q6eV16Con7SvDQYSr0KPYQimMHVehZv7
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove all the labels that have a key set to scopes
  herve4m.quay.quay_manifest_label:
    image: production/smallimage:v1.0.0
    key: scopes
    state: absent
    quay_host: https://quay.example.com
    quay_token: vgfH9zH5q6eV16Con7SvDQYSr0KPYQimMHVehZv7

Inputs

    
key:
    description:
    - Label's key.
    required: true
    type: str

image:
    description:
    - Manifest to update. 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 labels that match the I(key) and I(value)
      parameters. If you do not provide the I(value) parameter, then the module deletes
      all the labels with the I(key) parameter.
    - If C(present), then the module adds a label to the manifest.
    type: str

value:
    description:
    - Label's value. Required when C(state=present).
    type: str

replace:
    default: true
    description:
    - Only used when C(state=present).
    - If C(yes), then the module deletes all the labels that use the key you define in
      the I(key) parameter before adding the new label.
    - If C(no), then the module adds the new label even if existing labels already use
      the key you define in the I(key) parameter. Quay supports multiple labels with the
      same key.
    type: bool

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

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

id:
  description: Internal identifier of the label.
  returned: always
  sample: 155f20b3-7ebf-4796-9d18-eb5c54bf7364
  type: str
key:
  description: Label's key.
  returned: always
  sample: architecture
  type: str
media_type:
  description: Format of the label (C(text/plain) or C(application/json)).
  returned: always
  sample: text/plain
  type: str
source_type:
  description:
  - Whether the label has been set by the Containerfile/Dockerfile manifest (C(manifest)),
    or by an API call or from the web UI (C(api)).
  - Labels set in Containerfile/Dockerfile manifests are read-only.
  returned: always
  sample: api
  type: str
value:
  description: Label's value.
  returned: always
  sample: x86_64
  type: str