herve4m.quay.quay_message (1.2.0) — module

Manage Quay Container Registry global messages

| "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 global messages (message of the day) that display on the web UI pages.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure the message of the day is published
  herve4m.quay.quay_message:
    content: |
      # Information message

      Lorem **ipsum** dolor sit amet, `consectetur` adipiscing elit, sed do
      eiusmod tempor incididunt ut labore et dolore magna aliqua:

      * Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi
        ut aliquip ex ea commodo consequat.
      *  Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
         dolore eu fugiat nulla pariatur
    format: markdown
    severity: info
    state: present
    quay_host: https://quay.example.com
    quay_token: vgfH9zH5q6eV16Con7SvDQYSr0KPYQimMHVehZv7
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure a message in plain text is published
  herve4m.quay.quay_message:
    content: System maintenance tomorrow at 6 AM
    format: plain
    severity: info
    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 message severity is upgraded to warning
  herve4m.quay.quay_message:
    content: System maintenance tomorrow at 6 AM
    severity: warning
    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 message content is updated
  herve4m.quay.quay_message:
    content: System maintenance tomorrow at 7 AM
    # Find the message to update by a matching string
    search_string: tomorrow at 6 AM
    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 existing message as an error priority now
  herve4m.quay.quay_message:
    # Find the message to update by a matching string
    search_string: incididunt ut labore et dolore
    severity: error
    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 warning message is removed
  herve4m.quay.quay_message:
    # Find the message to delete by its exact content
    content: System maintenance tomorrow at 7 AM
    state: absent
    quay_host: https://quay.example.com
    quay_token: vgfH9zH5q6eV16Con7SvDQYSr0KPYQimMHVehZv7
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure the messages of the day are removed
  herve4m.quay.quay_message:
    # Find the messages to delete by a matching regular expression
    regexp: 'message\s+of\s+the\s+day'
    state: absent
    quay_host: https://quay.example.com
    quay_token: vgfH9zH5q6eV16Con7SvDQYSr0KPYQimMHVehZv7
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure the lorem ipsum error messages are removed
  herve4m.quay.quay_message:
    # Find the messages to delete by a matching string and severity
    search_string: lorem ipsum
    search_severity: error
    state: absent
    quay_host: https://quay.example.com
    quay_token: vgfH9zH5q6eV16Con7SvDQYSr0KPYQimMHVehZv7
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure all the warning messages are removed
  herve4m.quay.quay_message:
    search_severity: warning
    state: absent
    quay_host: https://quay.example.com
    quay_token: vgfH9zH5q6eV16Con7SvDQYSr0KPYQimMHVehZv7

Inputs

    
state:
    choices:
    - absent
    - present
    default: present
    description:
    - If C(absent), then the module deletes all the messages which content matches I(search_string),
      I(regexp), I(content), or I(search_severity).
    - If C(present), then the module creates the message if it does not already exist
      (that is, if no message matches I(search_string), I(regexp), or I(content)). Is
      several messages match, only one is updated and the others are deleted.
    type: str

format:
    aliases:
    - media_type
    choices:
    - markdown
    - plain
    description:
    - Format of the text in I(content).
    - If you do not set this parameter, then the module uses the C(plain) format.
    type: str

regexp:
    aliases:
    - regex
    description:
    - The regular expression to look for in the existing messages. This does not have
      to match an entire line.
    - For C(state=present), if several messages match, then the module updates one and
      deletes the others.
    - For C(state=absent), the module deletes all the messages that match.
    - Uses Python regular expressions. See U(https://docs.python.org/3/library/re.html).
    - Mutually exclusive with I(search_string).
    type: str

content:
    description:
    - Text of the message to display on each web UI page.
    type: str

severity:
    choices:
    - info
    - warning
    - error
    description:
    - Severity of the message.
    - If you do not set this parameter, then the module creates the message with the C(info)
      severity.
    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

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

search_string:
    description:
    - The literal string to look for in the existing messages. This does not have to match
      an entire line.
    - For C(state=present), if several messages match, then the module updates one and
      deletes the others.
    - For C(state=absent), the module deletes all the messages that match.
    - Mutually exclusive with I(regexp).
    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

search_severity:
    choices:
    - info
    - warning
    - error
    description:
    - Search messages by their severity level.
    - If you also set I(search_string), I(regexp), or I(content), messages must match
      all those criteria.
    type: str