image_serve

Role Documentation

Welcome to the “image_serve” role documentation.

Role Variables: main.yml

metadata:
  description: Verify that image-serve service is ready
  groups:
  - pre-upgrade
  - post-deployment
  - post-upgrade
  name: Image-serve availability

Molecule Scenarios

Molecule is being used to test the “image_serve” role. The following section highlights the drivers in service and provides an example playbook showing how the role is leveraged.

Scenario: default

Example default configuration
platforms:
- command: /sbin/init
  dockerfile: ../../../../.config/molecule/Dockerfile
  environment:
    http_proxy: '{{ lookup(''env'', ''http_proxy'') }}'
    https_proxy: '{{ lookup(''env'', ''https_proxy'') }}'
  etc_hosts:
    undercloud.ctlplane.mydomain.tld: 127.0.0.1
  hostname: centos
  image: centos/centos:stream8
  name: centos
  override_command: true
  pkg_extras: python*-setuptools
  privileged: true
  registry:
    url: quay.io
  ulimits:
  - host
  volumes:
  - /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
Example default playbook
- gather_facts: false
  hosts: all
  name: Converge
  tasks:
  - block:
    - include_role:
        name: image_serve
      name: run validation for wrong port
      vars:
        container_registry_port: 9999
    name: detect wrong port
    rescue:
    - meta: clear_host_errors
      name: Clear host errors
    - debug:
        msg: Detected faulty port!
      name: Status message
  - block:
    - include_role:
        name: image_serve
      name: Run validation for wrong config file
      vars:
        container_registry_httpd_config: /fake-image-serve.conf
    name: Run validation for wrong config file
    rescue:
    - meta: clear_host_errors
      name: Clear host errors
    - debug:
        msg: Detected wrong config file!
      name: Status message
  - block:
    - name: Stopping httpd
      systemd:
        name: httpd
        state: stopped
    - include_role:
        name: image_serve
      name: run validation for 404
    name: Ensure we detect faulty tree
    rescue:
    - meta: clear_host_errors
      name: Clear host errors
    - debug:
        msg: Detected faulty image serve tree!
      name: Status message
    - meta: end_play
      name: End play
  - fail:
      msg: 'The image_serve role should have detected httpd wasn''t running or

        index.json is absent.

        '
    name: Fail the test