Skip to content
Snippets Groups Projects
Unverified Commit a7cfda98 authored by paulfantom's avatar paulfantom
Browse files

switch to molecule v3

parent 8dc13ae0
No related branches found
No related tags found
No related merge requests found
---
extends: default extends: default
ignore: | ignore: |
.travis/ .travis/
......
...@@ -13,7 +13,7 @@ Deploy prometheus [node exporter](https://github.com/prometheus/node_exporter) u ...@@ -13,7 +13,7 @@ Deploy prometheus [node exporter](https://github.com/prometheus/node_exporter) u
## Requirements ## Requirements
- Ansible >= 2.7 (It might work on previous versions, but we cannot guarantee it) - Ansible >= 2.9 (It might work on previous versions, but we cannot guarantee it)
- gnu-tar on Mac deployer host (`brew install gnu-tar`) - gnu-tar on Mac deployer host (`brew install gnu-tar`)
- Passlib is required when using the basic authentatication feature (`pip install passlib[bcrypt]`) - Passlib is required when using the basic authentatication feature (`pip install passlib[bcrypt]`)
......
...@@ -3,40 +3,44 @@ dependency: ...@@ -3,40 +3,44 @@ dependency:
name: galaxy name: galaxy
driver: driver:
name: docker name: docker
lint:
name: yamllint
platforms: platforms:
- name: bionic - name: bionic
pre_build_image: true
image: quay.io/paulfantom/molecule-systemd:ubuntu-18.04 image: quay.io/paulfantom/molecule-systemd:ubuntu-18.04
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true privileged: true
volumes: volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro - /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: xenial - name: xenial
pre_build_image: true
image: quay.io/paulfantom/molecule-systemd:ubuntu-16.04 image: quay.io/paulfantom/molecule-systemd:ubuntu-16.04
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true privileged: true
volumes: volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro - /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: stretch - name: stretch
pre_build_image: true
image: quay.io/paulfantom/molecule-systemd:debian-9 image: quay.io/paulfantom/molecule-systemd:debian-9
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true privileged: true
volumes: volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro - /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: buster - name: buster
pre_build_image: true
image: quay.io/paulfantom/molecule-systemd:debian-10 image: quay.io/paulfantom/molecule-systemd:debian-10
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true privileged: true
volumes: volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro - /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: centos7 - name: centos7
pre_build_image: true
image: quay.io/paulfantom/molecule-systemd:centos-7 image: quay.io/paulfantom/molecule-systemd:centos-7
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true privileged: true
volumes: volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro - /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: centos8 - name: centos8
pre_build_image: true
image: quay.io/paulfantom/molecule-systemd:centos-8 image: quay.io/paulfantom/molecule-systemd:centos-8
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true privileged: true
...@@ -45,6 +49,7 @@ platforms: ...@@ -45,6 +49,7 @@ platforms:
groups: groups:
- python3 - python3
- name: fedora - name: fedora
pre_build_image: true
image: quay.io/paulfantom/molecule-systemd:fedora-30 image: quay.io/paulfantom/molecule-systemd:fedora-30
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true privileged: true
...@@ -54,21 +59,12 @@ platforms: ...@@ -54,21 +59,12 @@ platforms:
- python3 - python3
provisioner: provisioner:
name: ansible name: ansible
lint:
name: ansible-lint
playbooks: playbooks:
create: ../default/create.yml
prepare: prepare.yml prepare: prepare.yml
converge: playbook.yml converge: playbook.yml
destroy: ../default/destroy.yml
inventory: inventory:
group_vars: group_vars:
python3: python3:
ansible_python_interpreter: /usr/bin/python3 ansible_python_interpreter: /usr/bin/python3
scenario:
name: alternative
verifier: verifier:
name: testinfra name: testinfra
lint:
name: flake8
enabled: true
---
- name: Create
hosts: localhost
connection: local
gather_facts: false
no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}"
tasks:
- name: Create molecule instance(s)
docker_container:
name: "{{ item.name }}"
docker_host: "{{ item.docker_host | default('unix://var/run/docker.sock') }}"
hostname: "{{ item.name }}"
image: "{{ item.image }}"
state: started
recreate: false
log_driver: json-file
command: "{{ item.command | default(omit) }}"
privileged: "{{ item.privileged | default(omit) }}"
volumes: "{{ item.volumes | default(omit) }}"
capabilities: "{{ item.capabilities | default(omit) }}"
exposed_ports: "{{ item.exposed_ports | default(omit) }}"
published_ports: "{{ item.published_ports | default(omit) }}"
ulimits: "{{ item.ulimits | default(omit) }}"
networks: "{{ item.networks | default(omit) }}"
dns_servers: "{{ item.dns_servers | default(omit) }}"
register: server
with_items: "{{ molecule_yml.platforms }}"
async: 7200
poll: 0
- name: Wait for instance(s) creation to complete
async_status:
jid: "{{ item.ansible_job_id }}"
register: docker_jobs
until: docker_jobs.finished
retries: 300
with_items: "{{ server.results }}"
---
- name: Destroy
hosts: localhost
connection: local
gather_facts: false
no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}"
tasks:
- name: Destroy molecule instance(s)
docker_container:
name: "{{ item.name }}"
docker_host: "{{ item.docker_host | default('unix://var/run/docker.sock') }}"
state: absent
force_kill: "{{ item.force_kill | default(true) }}"
register: server
with_items: "{{ molecule_yml.platforms }}"
async: 7200
poll: 0
- name: Wait for instance(s) deletion to complete
async_status:
jid: "{{ item.ansible_job_id }}"
register: docker_jobs
until: docker_jobs.finished
retries: 300
with_items: "{{ server.results }}"
- name: Delete docker network(s)
docker_network:
name: "{{ item }}"
docker_host: "{{ item.docker_host | default('unix://var/run/docker.sock') }}"
state: absent
with_items: "{{ molecule_yml.platforms | molecule_get_docker_networks }}"
...@@ -3,40 +3,49 @@ dependency: ...@@ -3,40 +3,49 @@ dependency:
name: galaxy name: galaxy
driver: driver:
name: docker name: docker
lint: # lint: |
name: yamllint # set -e
# yamllint .
# ansible-lint
# flake8
platforms: platforms:
- name: bionic - name: bionic
pre_build_image: true
image: quay.io/paulfantom/molecule-systemd:ubuntu-18.04 image: quay.io/paulfantom/molecule-systemd:ubuntu-18.04
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true privileged: true
volumes: volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro - /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: xenial - name: xenial
pre_build_image: true
image: quay.io/paulfantom/molecule-systemd:ubuntu-16.04 image: quay.io/paulfantom/molecule-systemd:ubuntu-16.04
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true privileged: true
volumes: volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro - /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: stretch - name: stretch
pre_build_image: true
image: quay.io/paulfantom/molecule-systemd:debian-9 image: quay.io/paulfantom/molecule-systemd:debian-9
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true privileged: true
volumes: volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro - /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: buster - name: buster
pre_build_image: true
image: quay.io/paulfantom/molecule-systemd:debian-10 image: quay.io/paulfantom/molecule-systemd:debian-10
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true privileged: true
volumes: volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro - /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: centos7 - name: centos7
pre_build_image: true
image: quay.io/paulfantom/molecule-systemd:centos-7 image: quay.io/paulfantom/molecule-systemd:centos-7
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true privileged: true
volumes: volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro - /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: centos8 - name: centos8
pre_build_image: true
image: quay.io/paulfantom/molecule-systemd:centos-8 image: quay.io/paulfantom/molecule-systemd:centos-8
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true privileged: true
...@@ -45,6 +54,7 @@ platforms: ...@@ -45,6 +54,7 @@ platforms:
groups: groups:
- python3 - python3
- name: fedora - name: fedora
pre_build_image: true
image: quay.io/paulfantom/molecule-systemd:fedora-30 image: quay.io/paulfantom/molecule-systemd:fedora-30
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true privileged: true
...@@ -54,21 +64,12 @@ platforms: ...@@ -54,21 +64,12 @@ platforms:
- python3 - python3
provisioner: provisioner:
name: ansible name: ansible
lint:
name: ansible-lint
playbooks: playbooks:
create: create.yml
prepare: prepare.yml prepare: prepare.yml
converge: playbook.yml converge: playbook.yml
destroy: destroy.yml
inventory: inventory:
group_vars: group_vars:
python3: python3:
ansible_python_interpreter: /usr/bin/python3 ansible_python_interpreter: /usr/bin/python3
scenario:
name: default
verifier: verifier:
name: testinfra name: testinfra
lint:
name: flake8
enabled: true
...@@ -3,16 +3,16 @@ dependency: ...@@ -3,16 +3,16 @@ dependency:
name: galaxy name: galaxy
driver: driver:
name: docker name: docker
lint:
name: yamllint
platforms: platforms:
- name: buster - name: buster
pre_build_image: true
image: quay.io/paulfantom/molecule-systemd:debian-10 image: quay.io/paulfantom/molecule-systemd:debian-10
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true privileged: true
volumes: volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro - /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: fedora - name: fedora
pre_build_image: true
image: quay.io/paulfantom/molecule-systemd:fedora-30 image: quay.io/paulfantom/molecule-systemd:fedora-30
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true privileged: true
...@@ -22,8 +22,6 @@ platforms: ...@@ -22,8 +22,6 @@ platforms:
- python3 - python3
provisioner: provisioner:
name: ansible name: ansible
lint:
name: ansible-lint
playbooks: playbooks:
create: ../default/create.yml create: ../default/create.yml
prepare: ../default/prepare.yml prepare: ../default/prepare.yml
...@@ -33,10 +31,5 @@ provisioner: ...@@ -33,10 +31,5 @@ provisioner:
group_vars: group_vars:
python3: python3:
ansible_python_interpreter: /usr/bin/python3 ansible_python_interpreter: /usr/bin/python3
scenario:
name: latest
verifier: verifier:
name: testinfra name: testinfra
lint:
name: flake8
enabled: true
molecule>=2.15.0,<3.0.0 molecule>=3.0.0
molecule-docker
docker docker
ansible-lint>=3.4.0 ansible-lint>=3.4.0
testinfra>=1.7.0 testinfra>=1.7.0
......
[tox] [tox]
minversion = 1.8 minversion = 1.8
basepython = python3.7 basepython = python3.8
envlist = py37-ansible{27,28,29} envlist = py38-ansible{29,210}
skipsdist = true skipsdist = true
[travis:env] [travis:env]
ANSIBLE= ANSIBLE=
2.7: ansible27
2.8: ansible28
2.9: ansible29 2.9: ansible29
2.10: ansible210
[testenv] [testenv]
passenv = GH_* DOCKER_HOST MOLECULE_* passenv = GH_* DOCKER_HOST MOLECULE_*
deps = deps =
-rtest-requirements.txt -rtest-requirements.txt
ansible27: ansible<2.8
ansible28: ansible<2.9
ansible29: ansible<2.10 ansible29: ansible<2.10
ansible210: ansible<2.11
commands = commands =
{posargs:molecule test --all --destroy always} {posargs:molecule test --all --destroy always}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment