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
driver:
  name: docker
log: true
platforms:
- command: python -m SimpleHTTPServer 8787
  easy_install:
  - pip
  environment:
    http_proxy: '{{ lookup(''env'', ''http_proxy'') }}'
    https_proxy: '{{ lookup(''env'', ''https_proxy'') }}'
  hostname: centos7
  image: centos:7
  name: centos7
  override_command: true
  pkg_extras: python-setuptools python-enum34 python-netaddr epel-release ruby PyYAML
  volumes:
  - /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
- command: python3 -m http.server 8787
  environment:
    http_proxy: '{{ lookup(''env'', ''http_proxy'') }}'
    https_proxy: '{{ lookup(''env'', ''https_proxy'') }}'
  hostname: centos8
  image: centos:8
  name: centos8
  override_command: true
  pkg_extras: python*-setuptools python*-enum34 python*-netaddr ruby epel-release
    python*-PyYAML
  volumes:
  - /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
provisioner:
  env:
    ANSIBLE_LIBRARY: ../../../../library
    ANSIBLE_STDOUT_CALLBACK: yaml
  log: true
  name: ansible
scenario:
  test_sequence:
  - destroy
  - create
  - prepare
  - converge
  - verify
  - destroy
verifier:
  name: testinfra
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 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