Refactor CI pipelien and enable molecule testing #1
35
.drone.yml
35
.drone.yml
@ -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
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
# ---> Python
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
0
molecule/default/coverage.yml
Normal file
0
molecule/default/coverage.yml
Normal file
25
molecule/default/molecule.yml
Normal file
25
molecule/default/molecule.yml
Normal 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
|
5
molecule/default/playbook.yml
Normal file
5
molecule/default/playbook.yml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
roles:
|
||||
- role: xoxys.nginx
|
14
molecule/default/tests/test_default.py
Normal file
14
molecule/default/tests/test_default.py
Normal 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'
|
Loading…
Reference in New Issue
Block a user