From f2485cdec46b91ab89afe65501f637ad5c7e9233 Mon Sep 17 00:00:00 2001 From: Andrea Tosatto Date: Thu, 24 Aug 2017 16:05:30 +0200 Subject: [PATCH 1/4] Molecule v2 test-suite --- .gitignore | 31 +++------- .travis.yml | 35 ++++++----- .yamllint | 18 ++++++ molecule/README.md | 64 ++++++++++++++++++++ molecule/Vagrantfile | 38 ++++++++++++ molecule/common/Dockerfile.centos-systemd.j2 | 28 +++++++++ molecule/common/Dockerfile.debian-systemd.j2 | 33 ++++++++++ molecule/common/Dockerfile.default.j2 | 9 +++ molecule/common/create.yml | 59 ++++++++++++++++++ molecule/common/destroy.yml | 20 ++++++ molecule/common/molecule-vars.yml | 15 +++++ molecule/common/playbook.yml | 13 ++++ molecule/dnsdist-master/molecule.yml | 50 +++++++++++++++ molecule/dnsdist-master/scenario-vars.yml | 3 + molecule/dnsdist-master/tests/test_common.py | 34 +++++++++++ test-requirements.txt | 2 + tests/inventory | 1 - tests/test.yml | 5 -- 18 files changed, 412 insertions(+), 46 deletions(-) create mode 100644 .yamllint create mode 100644 molecule/README.md create mode 100644 molecule/Vagrantfile create mode 100644 molecule/common/Dockerfile.centos-systemd.j2 create mode 100644 molecule/common/Dockerfile.debian-systemd.j2 create mode 100644 molecule/common/Dockerfile.default.j2 create mode 100644 molecule/common/create.yml create mode 100644 molecule/common/destroy.yml create mode 100644 molecule/common/molecule-vars.yml create mode 100644 molecule/common/playbook.yml create mode 100644 molecule/dnsdist-master/molecule.yml create mode 100644 molecule/dnsdist-master/scenario-vars.yml create mode 100644 molecule/dnsdist-master/tests/test_common.py create mode 100644 test-requirements.txt delete mode 100644 tests/inventory delete mode 100644 tests/test.yml diff --git a/.gitignore b/.gitignore index 72f4dfc..68426dc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,24 +1,11 @@ +# Ignore the Python cache files +__pycache__ +*.pyc -# Created by https://www.gitignore.io/api/vim,linux - -### Vim ### -[._]*.s[a-w][a-z] -[._]s[a-w][a-z] -*.un~ -Session.vim -.netrwhist -*~ - - -### Linux ### -*~ - -# temporary files which can be created if a process still has a handle open of a deleted file -.fuse_hidden* - -# KDE directory preferences -.directory - -# Linux trash folder which might appear on any partition or disk -.Trash-* +# Ignore the vagrant, molecule and testinfra temp files +.vagrant +.molecule +.cache +# Ignore the Ansible retry files +*.retry diff --git a/.travis.yml b/.travis.yml index 36bbf62..1624046 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,29 +1,28 @@ --- + language: python python: "2.7" -# Use the new container infrastructure -sudo: false - -# Install ansible -addons: - apt: - packages: - - python-pip +sudo: required -install: - # Install ansible - - pip install ansible +# Enable the docker service +services: + - docker - # Check ansible version - - ansible --version +# Replace aufs with the vfs docker storage driver +# to prevent systemd to fail starting docker in docker. +before_install: + - sudo sed -i 's|DOCKER_OPTS=.*|DOCKER_OPTS="-H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock --storage-driver vfs"|g' /etc/default/docker + - sudo service docker restart + - docker info - # Create ansible.cfg with correct roles_path - - printf '[defaults]\nroles_path=../' >ansible.cfg +# Install molecule +install: + - pip install -r test-requirements.txt +# Tests all the scenarios script: - # Basic role syntax check - - ansible-playbook tests/test.yml -i tests/inventory --syntax-check + - molecule test --all notifications: - webhooks: https://galaxy.ansible.com/api/v1/notifications/ \ No newline at end of file + webhooks: https://galaxy.ansible.com/api/v1/notifications/ diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..86df876 --- /dev/null +++ b/.yamllint @@ -0,0 +1,18 @@ +extends: default + +rules: + + # Disable line-length and truthy values reporting + line-length: disable + truthy: disable + + # Max 1 space to separate the elements in brakets + braces: + max-spaces-inside: 1 + + # Max 1 space in empty brackets + brackets: + min-spaces-inside-empty: 0 + max-spaces-inside-empty: 1 + + diff --git a/molecule/README.md b/molecule/README.md new file mode 100644 index 0000000..23a9960 --- /dev/null +++ b/molecule/README.md @@ -0,0 +1,64 @@ +# Testing with Molecule + +This role uses [molecule](https://molecule.readthedocs.io/en/latest/) +to implement automated testing of its functionalities. + +## Requirements + +* Ansible >= 2.2 +* molecule v2 +* Docker + +## Create a Docker virtual machine (optional on most Linux distros) + +On some systems, e.g. OS X, is not possible to run successfully the docker-based molecule test-suite +because of the lack of systemd support (the services in the docker containers will fail to start). + +To overcome this issue, make sure to have + +* Vagrant +* Virtualbox +* docker-machine + +installed on your system and follow these instructions to create a docker virtual machine +to use for your tests + +```bash +# Create the virtual machine +vagrant up + +# Install docker inside the virtual machine +docker-machine create -d generic \ +--generic-ssh-user vagrant \ +--generic-ssh-key .vagrant/machines/molecule-dnsdist/virtualbox/private_key \ +--generic-ip-address "$(vagrant ssh -- hostname -I | cut -d ' ' -f 2)" \ +--engine-install-url "https://get.docker.com" \ +molecule-dnsdist + +# Connect your local docker client to the docker deamon running in the virtual machine +eval $(docker-machine env molecule-dnsdist) +``` + +To clean-up the environment just execute + +```bash +# Destroy the virtual machine +vagrant rm + +# Remove the docker virtual machine from the docker-machines list +docker-machine rm molecule-dnsdist +``` + +# Execute the tests + +```bash +# if using the docker virtual machine +eval $(docker-machine env molecule-dnsdist) + +# test all the scenarios +molecule test --all + +# execute only a specific scenario +# e.g. +molecule test --scenario-name dnsdist-1.2.x +``` diff --git a/molecule/Vagrantfile b/molecule/Vagrantfile new file mode 100644 index 0000000..1ffac17 --- /dev/null +++ b/molecule/Vagrantfile @@ -0,0 +1,38 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure("2") do |config| + # The most common configuration options are documented and commented below. + # For a complete reference, please see the online documentation at + # https://docs.vagrantup.com. + + config.vm.define "molecule-dnsdist" do |test| + + # Every Vagrant development environment requires a box. You can search for + # boxes at https://vagrantcloud.com/search. + test.vm.box = "bento/ubuntu-16.04" + + # Create a private network, which allows host-only access to the machine + # using a specific IP. + test.vm.network "private_network", type: "dhcp" + + # Provider-specific configuration so you can fine-tune various + # backing providers for Vagrant. These expose provider-specific options. + test.vm.provider "virtualbox" do |vb| + # Customize the VM name + vb.name = "molecule-dnsdist" + + # Customize the amount of memory on the VM: + vb.memory = "1024" + end + + # Enable provisioning with a shell script. Additional provisioners such as + # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the + # documentation for more information about their specific syntax and use. + # test.vm.provision "shell", inline: <<-SHELL + # apt-get update + # apt-get install -y apache2 + # SHELL + end + +end diff --git a/molecule/common/Dockerfile.centos-systemd.j2 b/molecule/common/Dockerfile.centos-systemd.j2 new file mode 100644 index 0000000..97cac1b --- /dev/null +++ b/molecule/common/Dockerfile.centos-systemd.j2 @@ -0,0 +1,28 @@ +FROM {{ item.image }} + +# Tell systemd that we're running inside a Docker container. +ENV container docker + +# Configure systemd to run into the container (see https://hub.docker.com/_/centos/) +RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \ +rm -f /lib/systemd/system/multi-user.target.wants/*;\ +rm -f /etc/systemd/system/*.wants/*;\ +rm -f /lib/systemd/system/local-fs.target.wants/*; \ +rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ +rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ +rm -f /lib/systemd/system/basic.target.wants/*;\ +rm -f /lib/systemd/system/anaconda.target.wants/*; + +# Install sudo and disable requiretty +RUN yum -y install sudo +RUN /usr/bin/sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers + +VOLUME [ "/sys/fs/cgroup" ] +CMD [ "/usr/sbin/init" ] + +# Make sure all the Ansible dependencies are there. +RUN touch /var/lib/rpm/* \ + && yum makecache fast \ + && yum update -y \ + && yum install -y python sudo yum-plugin-ovl bash \ + && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf diff --git a/molecule/common/Dockerfile.debian-systemd.j2 b/molecule/common/Dockerfile.debian-systemd.j2 new file mode 100644 index 0000000..90bb317 --- /dev/null +++ b/molecule/common/Dockerfile.debian-systemd.j2 @@ -0,0 +1,33 @@ +FROM {{ item.image }} + +# Tell systemd that we're running inside a Docker container. +ENV container docker + +# Make sure systemd is fully installed in the system. +RUN apt-get update \ + && apt-get install -y systemd \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# Don't start the optional systemd services. +RUN cd /lib/systemd/system/sysinit.target.wants/; ls | grep -v systemd-tmpfiles-setup | xargs rm -f $1 \ +rm -f /lib/systemd/system/multi-user.target.wants/*;\ +rm -f /etc/systemd/system/*.wants/*;\ +rm -f /lib/systemd/system/local-fs.target.wants/*; \ +rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ +rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ +rm -f /lib/systemd/system/basic.target.wants/*;\ +rm -f /lib/systemd/system/anaconda.target.wants/*; \ +rm -f /lib/systemd/system/plymouth*; \ +rm -f /lib/systemd/system/systemd-update-utmp*; + +RUN systemctl set-default multi-user.target + +VOLUME [ "/sys/fs/cgroup" ] +CMD [ "/sbin/init" ] + +# Make sure all the Ansible dependencies are there. +RUN apt-get update \ + && apt-get upgrade -y \ + && apt-get install -y python sudo bash ca-certificates gnupg \ + && apt-get clean diff --git a/molecule/common/Dockerfile.default.j2 b/molecule/common/Dockerfile.default.j2 new file mode 100644 index 0000000..a0701c9 --- /dev/null +++ b/molecule/common/Dockerfile.default.j2 @@ -0,0 +1,9 @@ +FROM {{ item.image }} + +RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \ + elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash initscripts && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ + elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \ + elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \ + elif [ $(command -v dnf) ]; then dnf makecache fast && dnf --assumeyes install python python-devel python2-dnf bash && dnf clean all; fi + +CMD [ "sleep", "infinity" ] diff --git a/molecule/common/create.yml b/molecule/common/create.yml new file mode 100644 index 0000000..f4df9f3 --- /dev/null +++ b/molecule/common/create.yml @@ -0,0 +1,59 @@ +--- + +- name: Create molecule Docker instance(s) + hosts: localhost + connection: local + gather_facts: False + vars_files: + - molecule-vars.yml + tasks: + - name: Create Dockerfiles from image names + template: + src: "{{ molecule_scenario_directory }}/../common/Dockerfile.{{ item.image_tpl | default('default') }}.j2" + dest: "{{ molecule_ephemeral_directory }}/Dockerfile_{{ item.image | regex_replace('[^a-zA-Z0-9_]', '_') }}" + with_items: "{{ molecule_yml.platforms }}" + register: platforms + + - name: Discover local Docker images + docker_image_facts: + name: "molecule_local/{{ item.item.name }}" + docker_host: "{{ docker_host | default(omit) }}" + cacert_path: "{{ docker_tls_ca_cert | default(omit) }}" + cert_path: "{{ docker_tls_client_cert | default(omit) }}" + key_path: "{{ docker_tls_client_key | default(omit) }}" + tls_verify: "{{ docker_tls_verify | default(omit) }}" + with_items: "{{ platforms.results }}" + register: docker_images + + - name: Build an Ansible compatible image + docker_image: + path: "{{ molecule_ephemeral_directory }}" + name: "molecule_local/{{ item.item.image }}" + dockerfile: "{{ item.item.dockerfile | default(item.invocation.module_args.dest) }}" + force: "{{ item.item.force | default(True) }}" + docker_host: "{{ docker_host | default(omit) }}" + cacert_path: "{{ docker_tls_ca_cert | default(omit) }}" + cert_path: "{{ docker_tls_client_cert | default(omit) }}" + key_path: "{{ docker_tls_client_key | default(omit) }}" + tls_verify: "{{ docker_tls_verify | default(omit) }}" + with_items: "{{ platforms.results }}" + when: platforms.changed or docker_images.results | map(attribute='images') | select('equalto', []) | list | count >= 0 + + - name: Create molecule instance(s) + docker_container: + name: "{{ item.name }}" + hostname: "{{ item.name }}" + image: "molecule_local/{{ item.image }}" + command: "{{ item.command | default(omit) }}" + privileged: yes + volumes: + # Mount the cgroups fs to allow SystemD to run into the containers + - "/sys/fs/cgroup:/sys/fs/cgroup:ro" + recreate: no + state: started + docker_host: "{{ docker_host | default(omit) }}" + cacert_path: "{{ docker_tls_ca_cert | default(omit) }}" + cert_path: "{{ docker_tls_client_cert | default(omit) }}" + key_path: "{{ docker_tls_client_key | default(omit) }}" + tls_verify: "{{ docker_tls_verify | default(omit) }}" + with_items: "{{ molecule_yml.platforms }}" diff --git a/molecule/common/destroy.yml b/molecule/common/destroy.yml new file mode 100644 index 0000000..3f16430 --- /dev/null +++ b/molecule/common/destroy.yml @@ -0,0 +1,20 @@ +--- + +- name: Destroy molecule Docker instance(s) + hosts: localhost + connection: local + gather_facts: False + vars_files: + - molecule-vars.yml + tasks: + - name: Destroy molecule instance(s) + docker_container: + name: "{{ item.name }}" + state: absent + force_kill: "{{ item.force_kill | default(True) }}" + docker_host: "{{ docker_host | default(omit) }}" + cacert_path: "{{ docker_tls_ca_cert | default(omit) }}" + cert_path: "{{ docker_tls_client_cert | default(omit) }}" + key_path: "{{ docker_tls_client_key | default(omit) }}" + tls_verify: "{{ docker_tls_verify | default(omit) }}" + with_items: "{{ molecule_yml.platforms }}" diff --git a/molecule/common/molecule-vars.yml b/molecule/common/molecule-vars.yml new file mode 100644 index 0000000..6a09843 --- /dev/null +++ b/molecule/common/molecule-vars.yml @@ -0,0 +1,15 @@ +--- + +# Molecule +molecule_file: "{{ lookup('env', 'MOLECULE_FILE') }}" +molecule_ephemeral_directory: "{{ lookup('env', 'MOLECULE_EPHEMERAL_DIRECTORY') }}" +molecule_scenario_directory: "{{ lookup('env', 'MOLECULE_SCENARIO_DIRECTORY') }}" +molecule_yml: "{{ lookup('file', molecule_file) | from_yaml }}" + +# Docker +docker_host: "{{ lookup('env', 'DOCKER_HOST') }}" +docker_cert_path: "{{ lookup('env', 'DOCKER_CERT_PATH') }}" +docker_tls_ca_cert: "{% if docker_cert_path %}{{ docker_cert_path }}/ca.pem{% endif %}" +docker_tls_client_key: "{% if docker_cert_path %}{{ docker_cert_path }}/key.pem{% endif %}" +docker_tls_client_cert: "{% if docker_cert_path %}{{ docker_cert_path }}/cert.pem{% endif %}" +docker_tls_verify: "{{ lookup('env', 'DOCKER_TLS_VERIFY') }}" diff --git a/molecule/common/playbook.yml b/molecule/common/playbook.yml new file mode 100644 index 0000000..f1b570a --- /dev/null +++ b/molecule/common/playbook.yml @@ -0,0 +1,13 @@ +--- + +- name: Install and configure dnsdist + hosts: all + vars: + molecule_scenario_directory: "{{ lookup('env', 'MOLECULE_SCENARIO_DIRECTORY') }}" + dnsdist_servers: + - '8.8.8.8' + - '127.0.0.1:5300' + vars_files: + - "{{ molecule_scenario_directory }}/scenario-vars.yml" + roles: + - { role: dnsdist-ansible } diff --git a/molecule/dnsdist-master/molecule.yml b/molecule/dnsdist-master/molecule.yml new file mode 100644 index 0000000..470be13 --- /dev/null +++ b/molecule/dnsdist-master/molecule.yml @@ -0,0 +1,50 @@ +--- + +scenario: + name: dnsdist-master + +driver: + name: docker + +platforms: + - name: centos-7 + image: centos:7 + image_tpl: centos-systemd + - name: centos-6 + image: centos:6 + - name: debian-9 + image: debian:9 + image_tpl: debian-systemd + command: /lib/systemd/systemd + - name: debian-8 + image: debian:8 + image_tpl: debian-systemd + - name: ubuntu-17.04 + image: ubuntu:17.04 + image_tpl: debian-systemd + - name: ubuntu-16.04 + image: ubuntu:16.04 + image_tpl: debian-systemd + +provisioner: + name: ansible + options: + diff: True + v: True + playbooks: + create: ../common/create.yml + converge: ../common/playbook.yml + destroy: ../common/destroy.yml + lint: + name: ansible-lint + +dependency: + name: galaxy + +lint: + name: yamllint + +verifier: + name: testinfra + lint: + name: flake8 diff --git a/molecule/dnsdist-master/scenario-vars.yml b/molecule/dnsdist-master/scenario-vars.yml new file mode 100644 index 0000000..962227e --- /dev/null +++ b/molecule/dnsdist-master/scenario-vars.yml @@ -0,0 +1,3 @@ +--- + +dnsdist_install_repo: "{{ dnsdist_powerdns_repo_master }}" diff --git a/molecule/dnsdist-master/tests/test_common.py b/molecule/dnsdist-master/tests/test_common.py new file mode 100644 index 0000000..cb8cd30 --- /dev/null +++ b/molecule/dnsdist-master/tests/test_common.py @@ -0,0 +1,34 @@ +import os + +import testinfra.utils.ansible_runner + +testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( + os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') + + +def test_dnsdist_configuration(host): + + f = host.file('/etc/dnsdist/dnsdist.conf') + assert f.exists + assert f.user == 'root' + assert f.group == 'root' + + +def test_dnsdist_installed(host): + + p = host.package('dnsdist') + assert p.is_installed + + +def test_dnsdist_service(host): + + # Testinfra fails on Debiand and Ubuntu to use systemd to get + # the status of the Docker daemon + dist = host.system_info.distribution + if dist == 'debian' or dist == 'ubuntu': + c = host.run("service dnsdist status") + assert c.rc == 0 + else: + s = host.service('dnsdist') + assert s.is_running + assert s.is_enabled diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..458f09f --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,2 @@ +molecule==2.0.0.0rc16 +docker==2.4.2 diff --git a/tests/inventory b/tests/inventory deleted file mode 100644 index d18580b..0000000 --- a/tests/inventory +++ /dev/null @@ -1 +0,0 @@ -localhost \ No newline at end of file diff --git a/tests/test.yml b/tests/test.yml deleted file mode 100644 index 6bc8afb..0000000 --- a/tests/test.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- hosts: localhost - remote_user: root - roles: - - {role: dnsdist, dnsdist_servers: ["8.8.8.8"]} From 2db4b9610f432e15dae2f232aaeaf89eaeec111d Mon Sep 17 00:00:00 2001 From: Andrea Tosatto Date: Thu, 24 Aug 2017 16:05:57 +0200 Subject: [PATCH 2/4] Minor fixes and optimizations to the dnsdist repo management logic --- defaults/main.yml | 2 +- tasks/repo-Debian.yml | 1 + tasks/repo-RedHat.yml | 2 +- templates/dnsdist.pin.j2 | 2 +- vars/main.yml | 8 ++++---- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index ef10b32..74a693e 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,7 +1,7 @@ --- # By default no additional repository is added to the hosts to install dnsdist -dnsdist_install_repo: "" +dnsdist_install_repo: "" # Install the EPEL repository. # EPEL is needed to satisfy some dnsdist dependencies like lidsodium diff --git a/tasks/repo-Debian.yml b/tasks/repo-Debian.yml index 04e5393..1497dfb 100644 --- a/tasks/repo-Debian.yml +++ b/tasks/repo-Debian.yml @@ -8,6 +8,7 @@ - name: Add the dnsdist APT Repository apt_repository: + filename: "{{ dnsdist_install_repo['name'] }}.list" repo: "{{ dnsdist_install_repo['apt_repo'] }}" state: present diff --git a/tasks/repo-RedHat.yml b/tasks/repo-RedHat.yml index 2bf0ac6..ce1c1ba 100644 --- a/tasks/repo-RedHat.yml +++ b/tasks/repo-RedHat.yml @@ -7,7 +7,7 @@ - name: Add the dnsdist YUM Repository yum_repository: - name: "{{ dnsdist_install_repo['yum_repo_name'] }}" + name: "{{ dnsdist_install_repo['name'] }}" description: DNSDist Repository baseurl: "{{ dnsdist_install_repo['yum_repo_baseurl'] }}" gpgkey: "{{ dnsdist_install_repo['gpg_key'] }}" diff --git a/templates/dnsdist.pin.j2 b/templates/dnsdist.pin.j2 index ecd3368..9522983 100644 --- a/templates/dnsdist.pin.j2 +++ b/templates/dnsdist.pin.j2 @@ -1,3 +1,3 @@ -Package: dnsdist-* +Package: dnsdist* Pin: origin {{ dnsdist_install_repo['apt_repo_origin'] }} Pin-Priority: 600 diff --git a/vars/main.yml b/vars/main.yml index 1407eee..43db01c 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,33 +1,33 @@ --- dnsdist_powerdns_repo_master: + name: "powerdns-dnsdist" apt_repo_origin: "repo.powerdns.com" apt_repo: "deb [arch=amd64] http://repo.powerdns.com/{{ ansible_distribution | lower }} {{ ansible_distribution_release | lower }}-dnsdist-master main" gpg_key: "http://repo.powerdns.com/CBC8B383-pub.asc" gpg_key_id: "D47975F8DAE32700A563E64FFF389421CBC8B383" yum_repo_baseurl: "http://repo.powerdns.com/centos/$basearch/$releasever/dnsdist-master" - yum_repo_name: "powerdns-dnsdist" dnsdist_powerdns_repo_10: + name: "powerdns-dnsdist" apt_repo_origin: "repo.powerdns.com" apt_repo: "deb [arch=amd64] http://repo.powerdns.com/{{ ansible_distribution | lower }} {{ ansible_distribution_release | lower }}-dnsdist-10 main" gpg_key: "http://repo.powerdns.com/FD380FBB-pub.asc" gpg_key_id: "9FAAA5577E8FCF62093D036C1B0C6205FD380FBB" yum_repo_baseurl: "http://repo.powerdns.com/centos/$basearch/$releasever/dnsdist-10" - yum_repo_name: "powerdns-dnsdist" dnsdist_powerdns_repo_11: + name: "powerdns-dnsdist" apt_repo_origin: "repo.powerdns.com" apt_repo: "deb [arch=amd64] http://repo.powerdns.com/{{ ansible_distribution | lower }} {{ ansible_distribution_release | lower }}-dnsdist-11 main" gpg_key: "http://repo.powerdns.com/FD380FBB-pub.asc" gpg_key_id: "9FAAA5577E8FCF62093D036C1B0C6205FD380FBB" yum_repo_baseurl: "http://repo.powerdns.com/centos/$basearch/$releasever/dnsdist-11" - yum_repo_name: "powerdns-dnsdist" dnsdist_powerdns_repo_12: + name: "powerdns-dnsdist" apt_repo_origin: "repo.powerdns.com" apt_repo: "deb [arch=amd64] http://repo.powerdns.com/{{ ansible_distribution | lower }} {{ ansible_distribution_release | lower }}-dnsdist-12 main" gpg_key: "http://repo.powerdns.com/FD380FBB-pub.asc" gpg_key_id: "9FAAA5577E8FCF62093D036C1B0C6205FD380FBB" yum_repo_baseurl: "http://repo.powerdns.com/centos/$basearch/$releasever/dnsdist-12" - yum_repo_name: "powerdns-dnsdist" From 4fea655f4c27389b052f2776b76f442a91458b80 Mon Sep 17 00:00:00 2001 From: Andrea Tosatto Date: Thu, 24 Aug 2017 16:35:54 +0200 Subject: [PATCH 3/4] Move the common tests to the common directory --- molecule/{dnsdist-master => common}/tests/test_common.py | 0 molecule/dnsdist-master/molecule.yml | 2 ++ 2 files changed, 2 insertions(+) rename molecule/{dnsdist-master => common}/tests/test_common.py (100%) diff --git a/molecule/dnsdist-master/tests/test_common.py b/molecule/common/tests/test_common.py similarity index 100% rename from molecule/dnsdist-master/tests/test_common.py rename to molecule/common/tests/test_common.py diff --git a/molecule/dnsdist-master/molecule.yml b/molecule/dnsdist-master/molecule.yml index 470be13..e132d8d 100644 --- a/molecule/dnsdist-master/molecule.yml +++ b/molecule/dnsdist-master/molecule.yml @@ -46,5 +46,7 @@ lint: verifier: name: testinfra + additional_files_or_dirs: + - ../common/tests/ lint: name: flake8 From dedfa84c1e4d3688311dd93a056ac045d9fb3c3b Mon Sep 17 00:00:00 2001 From: Andrea Tosatto Date: Fri, 25 Aug 2017 14:22:46 +0200 Subject: [PATCH 4/4] Fixing the build when the DOCKER_TLS_VERIFY env variable is not set --- molecule/common/molecule-vars.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/molecule/common/molecule-vars.yml b/molecule/common/molecule-vars.yml index 6a09843..607695a 100644 --- a/molecule/common/molecule-vars.yml +++ b/molecule/common/molecule-vars.yml @@ -12,4 +12,4 @@ docker_cert_path: "{{ lookup('env', 'DOCKER_CERT_PATH') }}" docker_tls_ca_cert: "{% if docker_cert_path %}{{ docker_cert_path }}/ca.pem{% endif %}" docker_tls_client_key: "{% if docker_cert_path %}{{ docker_cert_path }}/key.pem{% endif %}" docker_tls_client_cert: "{% if docker_cert_path %}{{ docker_cert_path }}/cert.pem{% endif %}" -docker_tls_verify: "{{ lookup('env', 'DOCKER_TLS_VERIFY') }}" +docker_tls_verify: "{{ lookup('env', 'DOCKER_TLS_VERIFY') | default('no', true) }}"