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: podman
log: true
platforms:
- command: /sbin/init
easy_install:
- pip
environment:
http_proxy: '{{ lookup(''env'', ''http_proxy'') }}'
https_proxy: '{{ lookup(''env'', ''https_proxy'') }}'
etc_hosts:
undercloud.ctlplane.mydomain.tld: 127.0.0.1
hostname: centos7
image: centos:7
name: centos7
override_command: true
pkg_extras: python-setuptools python-enum34 python-netaddr epel-release ruby PyYAML
privileged: true
ulimits: &id001
- host
volumes:
- /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
- command: /sbin/init
environment:
http_proxy: '{{ lookup(''env'', ''http_proxy'') }}'
https_proxy: '{{ lookup(''env'', ''https_proxy'') }}'
etc_hosts:
undercloud.ctlplane.mydomain.tld: 127.0.0.1
hostname: centos8
image: centos:8
name: centos8
override_command: true
pkg_extras: python*-setuptools python*-enum34 python*-netaddr ruby epel-release
python*-PyYAML
privileged: true
ulimits: *id001
volumes:
- /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
provisioner:
env:
ANSIBLE_ROLES_PATH: ../../../../roles/roles.galaxy/tripleo-ansible/tripleo_ansible/roles
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 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