Ansible molecule for CI/CD pipelines.
115
This image is based on the official Docker image for Docker and can be used to test Ansible roles and playbooks using Molecule. Along with molecule is installed Ansible, yamllint and ansible-lint.
The main goal of this image is to save time during CI/CD pipeline executions.
For Gitlab CI:
stages:
- test
image: speedyrails/molecule:3.0.8
variables:
# When using dind service, we need to instruct docker to talk with
# the daemon started inside of the service. The daemon is available
# with a network connection instead of the default
# /var/run/docker.sock socket. Docker 19.03 does this automatically
# by setting the DOCKER_HOST in
# https://github.com/docker-library/docker/blob/d45051476babc297257df490d22cbd806f1b11e4/19.03/docker-entrypoint.sh#L23-L29
#
# The 'docker' hostname is the alias of the service container as described at
# https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#accessing-the-services.
#
# Note that if you're using GitLab Runner 12.7 or earlier with the Kubernetes executor and Kubernetes 1.6 or earlier,
# the variable must be set to tcp://localhost:2376 because of how the
# Kubernetes executor connects services to the job container
# DOCKER_HOST: tcp://localhost:2376
#
# Is more safe set DOCKER_HOST here.
# The 'docker' hostname is the alias of the service container as described at
# https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#accessing-the-services
DOCKER_HOST: tcp://docker:2376
#
# When using dind, it's wise to use the overlayfs driver for
# improved performance.
DOCKER_DRIVER: overlay2
#
# Specify to Docker where to create the certificates, Docker will
# create them automatically on boot, and will create
# `/certs/client` that will be shared between the service and job
# container, thanks to volume mount from config.toml
DOCKER_TLS_CERTDIR: "/certs"
services:
- docker:dind
before_script:
- docker info
- python3 --version
- ansible --version
- molecule --version
- yamllint --version
- ansible-lint --version
molecule:
stage: test
tags:
- ansible
variables:
# Molecule output will use ANSI colors if stdout is an interactive TTY and
# TERM value seems to support it. You can define PY_COLORS=1 to force use
# of ANSI colors, which can be handly for some CI systems.
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
#
# Uncomment the following line to enable debugging on molecule container
# MOLECULE_DEBUG: '1'
script:
- molecule test
Content type
Image
Digest
Size
252.7 MB
Last updated
about 6 years ago
docker pull speedyrails/molecule:3.0.8