Extending ansible playbooks of ubuntu support.
Creating new test with Ubuntu image for Molecule in docker role.
Issue-ID: OOM-1671
Signed-off-by: Jan Benedikt <j.benedikt@partner.samsung.com>
Change-Id: I4786dcd4b2de3f8d189db3b619c3d75315302506
docker:
log_max_size: 100m
log_max_file: 3
+packages:
+ RedHat:
+ - python-docker-py
+ - python-jsonpointer
+ Debian:
+ - python3-docker
+ - python3-json-pointer
+ - iproute2
host_vars:
infrastructure-server:
cluster_ip: 1.2.3.4
+scenario:
+ name: default
verifier:
name: testinfra
options:
import os
import pytest
+import json
import testinfra.utils.ansible_runner
assert f.exists
assert f.user == 'root'
assert f.group == 'root'
- assert f.content_string == """{
- "log-opts": {
- "max-size": "100m",
- "max-file": "3"
- },
- "dns": [
- "1.2.3.4"
- ],
- "log-driver": "json-file"
-}"""
+ print(f.content_string)
+ json_data = json.loads(f.content_string)
+ assert json_data["log-driver"] == "json-file"
+ assert json_data["log-opts"]["max-size"] == "100m"
+ assert json_data["log-opts"]["max-file"] == "3"
+ assert json_data["dns"][0] == "1.2.3.4"
--- /dev/null
+---
+dependency:
+ name: galaxy
+driver:
+ name: docker
+lint:
+ name: yamllint
+platforms:
+ - name: infrastructure-server
+ image: molecule-${PREBUILD_PLATFORM_DISTRO:-ubuntu}:${PREBUILD_DISTRO_VERSION:-18.04}
+ pre_build_image: true
+ privileged: true
+ command: ${MOLECULE_DOCKER_COMMAND:-""}
+ groups:
+ - infrastructure
+ networks:
+ - name: docker_install
+ purge_networks: true
+ volumes:
+ - /var/lib/docker
+provisioner:
+ name: ansible
+ lint:
+ name: ansible-lint
+ playbooks:
+ prepare: ../default/prepare.yml
+ converge: ../default/playbook.yml
+ env:
+ ANSIBLE_ROLES_PATH: ../../../../test/roles
+ ANSIBLE_LIBRARY: ../../../../library
+ inventory:
+ host_vars:
+ infrastructure-server:
+ cluster_ip: 1.2.3.4
+ remote_tmp: $HOME/.ansible/tmp
+scenario:
+ name: ubuntu
+verifier:
+ name: testinfra
+ options:
+ verbose: true
+ lint:
+ name: flake8
+ options:
+ ignore: W291 # trailing whitespace
+ directory: ../default/tests/
notify:
- Restart Docker
-- name: Install docker python module
+- name: Install required packages
package:
- name: 'python-docker-py'
- state: present
-
-
-- name: Install python jsonpointer module
- package:
- name: 'python-jsonpointer'
+ name: "{{ item }}"
state: present
+ loop: "{{ packages[ansible_os_family] }}"
- name: Ensure /etc/docker exists
file: