diff --git a/.yamllint b/.yamllint index 45d9356..a003b96 100644 --- a/.yamllint +++ b/.yamllint @@ -1,3 +1,4 @@ +--- extends: default ignore: | .travis/ diff --git a/README.md b/README.md index 451da67..60e4fd6 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Deploy prometheus [node exporter](https://github.com/prometheus/node_exporter) u ## 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`) - Passlib is required when using the basic authentatication feature (`pip install passlib[bcrypt]`) diff --git a/molecule/alternative/molecule.yml b/molecule/alternative/molecule.yml index 22a7ccb..c03bcf2 100644 --- a/molecule/alternative/molecule.yml +++ b/molecule/alternative/molecule.yml @@ -3,40 +3,44 @@ dependency: name: galaxy driver: name: docker -lint: - name: yamllint platforms: - name: bionic + pre_build_image: true image: quay.io/paulfantom/molecule-systemd:ubuntu-18.04 docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" privileged: true volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro - name: xenial + pre_build_image: true image: quay.io/paulfantom/molecule-systemd:ubuntu-16.04 docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" privileged: true volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro - name: stretch + pre_build_image: true image: quay.io/paulfantom/molecule-systemd:debian-9 docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" privileged: true volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro - name: buster + pre_build_image: true image: quay.io/paulfantom/molecule-systemd:debian-10 docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" privileged: true volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro - name: centos7 + pre_build_image: true image: quay.io/paulfantom/molecule-systemd:centos-7 docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" privileged: true volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro - name: centos8 + pre_build_image: true image: quay.io/paulfantom/molecule-systemd:centos-8 docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" privileged: true @@ -45,6 +49,7 @@ platforms: groups: - python3 - name: fedora + pre_build_image: true image: quay.io/paulfantom/molecule-systemd:fedora-30 docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" privileged: true @@ -54,21 +59,12 @@ platforms: - python3 provisioner: name: ansible - lint: - name: ansible-lint playbooks: - create: ../default/create.yml prepare: prepare.yml converge: playbook.yml - destroy: ../default/destroy.yml inventory: group_vars: python3: ansible_python_interpreter: /usr/bin/python3 -scenario: - name: alternative verifier: name: testinfra - lint: - name: flake8 - enabled: true diff --git a/molecule/default/create.yml b/molecule/default/create.yml deleted file mode 100644 index 022fe2a..0000000 --- a/molecule/default/create.yml +++ /dev/null @@ -1,37 +0,0 @@ ---- -- 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 }}" diff --git a/molecule/default/destroy.yml b/molecule/default/destroy.yml deleted file mode 100644 index 2c2bf11..0000000 --- a/molecule/default/destroy.yml +++ /dev/null @@ -1,32 +0,0 @@ ---- -- 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 }}" diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 619be2b..8937ee8 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -3,40 +3,49 @@ dependency: name: galaxy driver: name: docker -lint: - name: yamllint +# lint: | +# set -e +# yamllint . +# ansible-lint +# flake8 platforms: - name: bionic + pre_build_image: true image: quay.io/paulfantom/molecule-systemd:ubuntu-18.04 docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" privileged: true volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro - name: xenial + pre_build_image: true image: quay.io/paulfantom/molecule-systemd:ubuntu-16.04 docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" privileged: true volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro - name: stretch + pre_build_image: true image: quay.io/paulfantom/molecule-systemd:debian-9 docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" privileged: true volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro - name: buster + pre_build_image: true image: quay.io/paulfantom/molecule-systemd:debian-10 docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" privileged: true volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro - name: centos7 + pre_build_image: true image: quay.io/paulfantom/molecule-systemd:centos-7 docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" privileged: true volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro - name: centos8 + pre_build_image: true image: quay.io/paulfantom/molecule-systemd:centos-8 docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" privileged: true @@ -45,6 +54,7 @@ platforms: groups: - python3 - name: fedora + pre_build_image: true image: quay.io/paulfantom/molecule-systemd:fedora-30 docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" privileged: true @@ -54,21 +64,12 @@ platforms: - python3 provisioner: name: ansible - lint: - name: ansible-lint playbooks: - create: create.yml prepare: prepare.yml converge: playbook.yml - destroy: destroy.yml inventory: group_vars: python3: ansible_python_interpreter: /usr/bin/python3 -scenario: - name: default verifier: name: testinfra - lint: - name: flake8 - enabled: true diff --git a/molecule/latest/molecule.yml b/molecule/latest/molecule.yml index 5052221..a5a9ceb 100644 --- a/molecule/latest/molecule.yml +++ b/molecule/latest/molecule.yml @@ -3,16 +3,16 @@ dependency: name: galaxy driver: name: docker -lint: - name: yamllint platforms: - name: buster + pre_build_image: true image: quay.io/paulfantom/molecule-systemd:debian-10 docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" privileged: true volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro - name: fedora + pre_build_image: true image: quay.io/paulfantom/molecule-systemd:fedora-30 docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}" privileged: true @@ -22,8 +22,6 @@ platforms: - python3 provisioner: name: ansible - lint: - name: ansible-lint playbooks: create: ../default/create.yml prepare: ../default/prepare.yml @@ -33,10 +31,5 @@ provisioner: group_vars: python3: ansible_python_interpreter: /usr/bin/python3 -scenario: - name: latest verifier: name: testinfra - lint: - name: flake8 - enabled: true diff --git a/test-requirements.txt b/test-requirements.txt index efa5a5c..1b6e9a9 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,4 +1,5 @@ -molecule>=2.15.0,<3.0.0 +molecule>=3.0.0 +molecule-docker docker ansible-lint>=3.4.0 testinfra>=1.7.0 diff --git a/tox.ini b/tox.ini index 3ba82ff..53f0642 100644 --- a/tox.ini +++ b/tox.ini @@ -1,21 +1,19 @@ [tox] minversion = 1.8 -basepython = python3.7 -envlist = py37-ansible{27,28,29} +basepython = python3.8 +envlist = py38-ansible{29,210} skipsdist = true [travis:env] ANSIBLE= - 2.7: ansible27 - 2.8: ansible28 2.9: ansible29 + 2.10: ansible210 [testenv] passenv = GH_* DOCKER_HOST MOLECULE_* deps = -rtest-requirements.txt - ansible27: ansible<2.8 - ansible28: ansible<2.9 ansible29: ansible<2.10 + ansible210: ansible<2.11 commands = {posargs:molecule test --all --destroy always}