-
-
Save g2g/190dbd6f3e8cbe78532c2c67a1cfb8ab to your computer and use it in GitHub Desktop.
Ansible molecule Gitlab CI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# See https://gitlab.com/richardskumat/ansible-role-client-debian-role/-/blob/master/.gitlab-ci.yml | |
image: qwe1/dind-ansible-molecule:latest | |
variables: | |
# DOCKER_HOST: tcp://docker:2375/ | |
DOCKER_DRIVER: overlay2 | |
# https://gitlab.com/gitlab-org/gitlab-ce/issues/64959 | |
# 19.03 had some breaking changes compared to 18.09 | |
DOCKER_TLS_CERTDIR: "" | |
services: | |
- docker:dind | |
stages: | |
- test | |
before_script: | |
- docker info | |
- ansible --version | |
- molecule --version | |
test_d10: | |
stage: test | |
tags: | |
- ansible | |
variables: | |
MOLECULE_DISTRO: "geerlingguy/docker-debian10-ansible:testing" | |
script: | |
- cd roles/common | |
- molecule test | |
# need to setup a Matrix (https://docs.gitlab.com/ee/ci/yaml/#parallel-matrix-jobs) | |
#test_d8: | |
# stage: test | |
# tags: | |
# - ansible | |
# variables: | |
# MOLECULE_DISTRO: "geerlingguy/docker-debian8-ansible:testing" | |
# script: | |
# - cd roles/common | |
# - molecule test | |
#test_d9: | |
# stage: test | |
# tags: | |
# - ansible | |
# variables: | |
# MOLECULE_DISTRO: "geerlingguy/docker-debian9-ansible:testing" | |
# script: | |
# - cd roles/common | |
# - molecule test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# See https://github.com/ContinuousSecurityTooling/ansible-role-secure-docker/blob/master/molecule/default/molecule.yml | |
# See https://gitlab.com/richardskumat/ansible-role-client-debian-role/-/blob/master/molecule/default/molecule.yml | |
dependency: | |
name: galaxy | |
driver: | |
name: docker | |
lint: | | |
set -e | |
yamllint -c molecule/default/yaml-lint.yml . | |
ansible-lint -c molecule/default/ansible-lint.yml | |
platforms: | |
- name: instance | |
image: "${MOLECULE_DISTRO:-qwe1/docker-debian:10-nonfree}" | |
command: ${MOLECULE_DOCKER_COMMAND:-""} | |
# capabilities: | |
# - SYS_ADMIN # Needed to change hostname via playbook | |
# see https://github.com/ansible/ansible/issues/19681#issuecomment-450425779 | |
# - AUDIT_CONTROL | |
# - AUDIT_READ | |
volumes: | |
- /sys/fs/cgroup:/sys/fs/cgroup:ro | |
privileged: true | |
pre_build_image: true | |
# groups: | |
# - testgroup | |
provisioner: | |
name: ansible | |
log: true | |
config_options: | |
defaults: | |
local_tmp: /tmp/.ansible-$USER/tmp | |
remote_tmp: /tmp/.ansible-$USER/tmp | |
connection_options: | |
ansible_user: root | |
inventory: | |
links: | |
group_vars: ../../../../inventories/production/group_vars/ | |
host_vars: ../../../../inventories/production/host_vars/ | |
playbooks: | |
converge: playbook.yml | |
options: | |
vvv: true | |
scenario: | |
name: default |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment