test molecule integration
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Robert Kaussow 2019-02-26 15:13:50 +01:00
parent 2b5734f744
commit 50bbe8619e
6 changed files with 70 additions and 14 deletions

View File

@ -3,20 +3,27 @@ kind: pipeline
name: default
steps:
- name: ansible-latest
image: python:2.7
pull: always
commands:
- pip install ansible ansible-later -q
- git clone https://gitea.rknet.org/ansible/ansible-later-policy.git ~/policy
- git ls-files *[^LICENSE,.md] | xargs ansible-later -c ~/policy/config.ini
depends_on: [ clone ]
# - name: ansible-latest
# image: python:2.7
# pull: always
# commands:
# - pip install ansible ansible-later -q
# - git clone https://gitea.rknet.org/ansible/ansible-later-policy.git ~/policy
# - git ls-files *[^LICENSE,.md] | xargs ansible-later -c ~/policy/config.ini
# depends_on: [ clone ]
- name: ansible-master
image: python:2.7
# - name: ansible-master
# image: python:2.7
# pull: always
# commands:
# - pip install ansible ansible-later -q
# - git clone https://gitea.rknet.org/ansible/ansible-later-policy.git ~/policy
# - git ls-files *[^LICENSE,.md] | xargs ansible-later -c ~/policy/config.ini
# depends_on: [ clone ]
- name: molecule
image: quay.io/ansible/molecule
pull: always
commands:
- pip install ansible ansible-later -q
- git clone https://gitea.rknet.org/ansible/ansible-later-policy.git ~/policy
- git ls-files *[^LICENSE,.md] | xargs ansible-later -c ~/policy/config.ini
depends_on: [ clone ]
- pip install ansible -qq
- molecule test

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
# ---> Python
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

View File

View File

@ -0,0 +1,25 @@
---
dependency:
name: galaxy
driver:
name: delegated
options:
managed: False
ansible_connection_options:
ansible_connection: local
lint:
name: yamllint
platforms:
- name: instance
provisioner:
name: ansible
lint:
name: ansible-lint
playbooks:
converge: coverage.yml
scenario:
name: default
verifier:
name: testinfra
lint:
name: flake8

View File

@ -0,0 +1,5 @@
---
- name: Converge
hosts: all
roles:
- role: xoxys.nginx

View File

@ -0,0 +1,14 @@
import os
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'