Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Molecule v2 #5

Merged
merged 7 commits into from
Nov 16, 2018
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.*~
*.pyc
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
- docker

install:
- pip install ome-ansible-molecule-dependencies
- pip install "ome-ansible-molecule<0.5"

script:
- molecule test
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Base Dependencies
=================

[![Build Status](https://travis-ci.org/openmicroscopy/ansible-role-basedeps.svg)](https://travis-ci.org/openmicroscopy/ansible-role-basedeps)
[![Ansible Role](https://img.shields.io/ansible/role/14288.svg)](https://galaxy.ansible.com/openmicroscopy/basedeps/)

Base dependencies for most servers.

These dependencies should be suitable for installation on a minimal production server.
Expand All @@ -17,7 +20,7 @@ Example Playbook

- hosts: servers
roles:
- { role: basedeps }
- { role: openmicroscopy.basedeps }


Author Information
Expand Down
11 changes: 6 additions & 5 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
galaxy_info:
author: ome-devel@lists.openmicroscopy.org.uk
description: Base dependencies for most servers.
company: Open Microscopy Environment
license: BSD
min_ansible_version: 2.1
platforms:
- name: EL
versions:
- 7
- name: EL
versions:
- 7
categories:
- cloud
- system
- cloud
- system
14 changes: 0 additions & 14 deletions molecule.yml

This file was deleted.

14 changes: 14 additions & 0 deletions molecule/default/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Molecule managed

{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}

RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && 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 xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi
26 changes: 26 additions & 0 deletions molecule/default/INSTALL.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
*******
Docker driver installation guide
*******

Requirements
============

* General molecule dependencies (see https://molecule.readthedocs.io/en/latest/installation.html)
* Docker Engine
* docker-py
* docker

Install
=======

Ansible < 2.6

.. code-block:: bash

$ sudo pip install docker-py

Ansible >= 2.6

.. code-block:: bash

$ sudo pip install docker
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it's auto-generated, but I this it'd be better to remove INSTALL.rst since we have our own set of dependencies.

Copy link
Member Author

@sbesson sbesson Nov 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See ba6baa7

20 changes: 20 additions & 0 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
platforms:
- name: instance
image: centos:7
provisioner:
name: ansible
lint:
name: ansible-lint
scenario:
name: default
verifier:
name: testinfra
lint:
name: flake8
3 changes: 2 additions & 1 deletion playbook.yml → molecule/default/playbook.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
- hosts: all
- name: Converge
hosts: all
roles:
- role: ansible-role-basedeps
21 changes: 21 additions & 0 deletions molecule/default/tests/test_default.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import os

import pytest
import testinfra.utils.ansible_runner

testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')


def test_hosts_file(host):
f = host.file('/etc/hosts')

assert f.exists
assert f.user == 'root'
assert f.group == 'root'


@pytest.mark.parametrize("package", [
'patch', 'redhat-lsb-core', 'rsync', 'tar', 'unzip', 'wget', 'zip'])
def test_packages(host, package):
assert host.package(package).is_installed
4 changes: 2 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# tasks file for roles/basedeps

- name: system packages | install epel repo
become: yes
become: true
yum:
name: epel-release
state: present

- name: system packages | basic system utils
become: yes
become: true
yum:
name: "{{ item }}"
state: present
Expand Down
1 change: 0 additions & 1 deletion tests/inventory

This file was deleted.

5 changes: 0 additions & 5 deletions tests/test.yml

This file was deleted.

12 changes: 0 additions & 12 deletions tests/test_default.py

This file was deleted.