summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Savineau <dsavinea@redhat.com>2019-02-08 15:17:09 -0500
committerDimitri Savineau <dsavinea@redhat.com>2019-02-08 15:38:51 -0500
commite9bf77f0c507d763e8850c72e6436eba02dd832d (patch)
treec5cd7a1cbd9e5a4930c5893b44873dd5ebb5d7de
parentbddb50473c532e20a36dbd3d60291e92b10177d4 (diff)
Add molecule configuration
At this time converge, idempotence and verify aren't executed due to the dependency on a DCI api server. We need the dci-ansible source for this role. Change-Id: I6d9800af39b5788b26c44407d363e967dc45de4f
-rw-r--r--.gitignore1
-rw-r--r--.yamllint10
-rw-r--r--molecule/default/Dockerfile.j213
-rw-r--r--molecule/default/molecule.yml37
-rw-r--r--molecule/default/playbook.yml6
-rw-r--r--tox.ini27
6 files changed, 94 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..172bf57
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+.tox
diff --git a/.yamllint b/.yamllint
new file mode 100644
index 0000000..a4d53d6
--- /dev/null
+++ b/.yamllint
@@ -0,0 +1,10 @@
+extends: default
+
+rules:
+ braces:
+ max-spaces-inside: 1
+ level: error
+ brackets:
+ max-spaces-inside: 1
+ level: error
+ line-length: disable
diff --git a/molecule/default/Dockerfile.j2 b/molecule/default/Dockerfile.j2
new file mode 100644
index 0000000..d6e583a
--- /dev/null
+++ b/molecule/default/Dockerfile.j2
@@ -0,0 +1,13 @@
+{% if item.registry is defined %}
+FROM {{ item.registry.url }}/{{ item.image }}
+{% else %}
+FROM {{ item.image }}
+{% endif %}
+
+RUN yum install -y epel-release https://packages.distributed-ci.io/dci-release.el7.noarch.rpm && \
+ yum install -y sudo ansible python2-dciclient && \
+ yum clean all
+
+RUN adduser centos && \
+ echo 'centos ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/90-centos && \
+ chmod 440 /etc/sudoers.d/90-centos
diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml
new file mode 100644
index 0000000..0fe6436
--- /dev/null
+++ b/molecule/default/molecule.yml
@@ -0,0 +1,37 @@
+---
+dependency:
+ name: galaxy
+ enabled: false
+driver:
+ name: docker
+lint:
+ name: yamllint
+platforms:
+ - name: el7
+ image: centos:latest
+ command: /sbin/init
+ capabilities:
+ - SYS_ADMIN
+provisioner:
+ name: ansible
+ connection_options:
+ ansible_user: centos
+ env:
+ ANSIBLE_LIBRARY: /var/tmp/dci/modules/
+ ANSIBLE_MODULE_UTILS: /var/tmp/dci/module_utils/
+ lint:
+ name: ansible-lint
+scenario:
+ name: default
+ test_sequence:
+ - lint
+ - destroy
+ - dependency
+ - syntax
+ - create
+ - prepare
+ - destroy
+verifier:
+ name: testinfra
+ lint:
+ name: flake8
diff --git a/molecule/default/playbook.yml b/molecule/default/playbook.yml
new file mode 100644
index 0000000..10a352d
--- /dev/null
+++ b/molecule/default/playbook.yml
@@ -0,0 +1,6 @@
+---
+- name: Converge
+ hosts: all
+ tasks:
+ - include_role:
+ name: ansible-role-dci-import-keys
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 0000000..46d2b9e
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,27 @@
+[tox]
+minversion = 1.8
+envlist = py{27,36}
+skipsdist = true
+
+[testenv]
+passenv = *
+deps =
+ ansible>=2.7,<2.8
+ docker
+ molecule
+whitelist_externals =
+ git
+ rm
+commands =
+ rm -rf /var/tmp/dci
+ git clone https://softwarefactory-project.io/r/dci-ansible /var/tmp/dci
+
+[testenv:py27]
+commands =
+ {[testenv]commands}
+ molecule test
+
+[testenv:py36]
+commands =
+ {[testenv]commands}
+ molecule test