Refactor CI pipelien and enable molecule testing #1

Merged
xoxys merged 131 commits from molecule-dev into master 2019-03-25 21:23:40 +00:00
6 changed files with 70 additions and 14 deletions
Showing only changes of commit 50bbe8619e - Show all commits

View File

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

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'