Skip to content
Snippets Groups Projects
Commit 57667146 authored by nimrod's avatar nimrod
Browse files

Merge branch 'master' of /home/nimrod/Documents/Shore/Ansible/example

# Conflicts:
#	.travis.yml
parents bb7a8720 d5ce1eab
No related branches found
No related tags found
No related merge requests found
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
hooks: hooks:
- id: ansible-syntax-check - id: ansible-syntax-check
- repo: https://github.com/willthames/ansible-lint - repo: https://github.com/willthames/ansible-lint
sha: v3.4.12 sha: v3.4.13
hooks: hooks:
- id: ansible-lint - id: ansible-lint
files: tests/playbook.yml files: tests/playbook.yml
......
...@@ -9,13 +9,9 @@ env: ...@@ -9,13 +9,9 @@ env:
- VBOX_MEMORY=2048 - VBOX_MEMORY=2048
- VBOX_HWVIRTEX=off - VBOX_HWVIRTEX=off
matrix: matrix:
- TOXENV=pre-commit
- TOXENV=trusty - TOXENV=trusty
- &jessie TOXENV=jessie - &jessie TOXENV=jessie
matrix:
fast_finish: True
allow_failures:
- env: *jessie
cache: cache:
- pip - pip
- directories: - directories:
...@@ -26,7 +22,7 @@ install: ...@@ -26,7 +22,7 @@ install:
- sudo apt-get install -y linux-headers-$(uname -r) virtualbox - sudo apt-get install -y linux-headers-$(uname -r) virtualbox
- wget https://releases.hashicorp.com/vagrant/1.9.1/vagrant_1.9.1_x86_64.deb - wget https://releases.hashicorp.com/vagrant/1.9.1/vagrant_1.9.1_x86_64.deb
- sudo dpkg -i vagrant_1.9.1_x86_64.deb - sudo dpkg -i vagrant_1.9.1_x86_64.deb
- pip install tox-travis | cat - &pip_install pip install tox-travis | cat
script: script:
- travis_wait 45 tox - travis_wait 45 tox
...@@ -35,3 +31,12 @@ notifications: ...@@ -35,3 +31,12 @@ notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/ webhooks: https://galaxy.ansible.com/api/v1/notifications/
email: false email: false
on_failure: never on_failure: never
matrix:
fast_finish: True
include:
- env:
TOXENV: pre-commit
install:
- *pip_install
sudo: False
/*
Jenkins pipeline for testing an Ansible role.
Required software on the agent:
- Python 2.7.
- Tox.
- Vagrant.
- Virtualbox.
*/
pipeline {
agent any
environment {
VBOX_HWVIRTEX = off
}
stages {
stage('install') {
steps {
sh 'git submodule update --init --recursive'
}
}
stage('test') {
steps {
parallel (
'pre-commit': {
sh 'tox -e pre-commit'
}
'molecule': {
sh 'tox'
}
)
}
}
}
post {
success {
sh 'tox -e import'
}
}
}
...@@ -29,7 +29,7 @@ vagrant: ...@@ -29,7 +29,7 @@ vagrant:
- name: precise - name: precise
box: hashicorp/precise32 box: hashicorp/precise32
- name: stretch - name: stretch
box: remram/debian-9-i386 box: koalephant/debian9-i386
- name: jessie - name: jessie
box: deb/jessie-i386 box: deb/jessie-i386
- name: wheezy - name: wheezy
......
ansible==2.3.0.0 ansible==2.3.1.0
testinfra==1.5.5 testinfra==1.6.4
molecule==1.24.0 molecule==1.25.0
ansible-lint==3.4.12 ansible-lint==3.4.13
python-vagrant==0.5.14 python-vagrant==0.5.15
netaddr==0.7.19 netaddr==0.7.19
passlib==1.7.1 passlib==1.7.1
bcrypt==3.1.3 bcrypt==3.1.3
...@@ -3,10 +3,10 @@ from testinfra.utils.ansible_runner import AnsibleRunner ...@@ -3,10 +3,10 @@ from testinfra.utils.ansible_runner import AnsibleRunner
testinfra_hosts = AnsibleRunner('.molecule/ansible_inventory').get_hosts('all') testinfra_hosts = AnsibleRunner('.molecule/ansible_inventory').get_hosts('all')
def test_example(Command): def test_example(host):
assert Command('uname').rc == 0 assert host.run('uname').rc == 0
def test_root(Command, Sudo): def test_root(host):
with Sudo(): with host.sudo():
assert Command('whoami').stdout.strip() == 'root' assert host.run('whoami').stdout.strip() == 'root'
...@@ -24,3 +24,8 @@ commands = ...@@ -24,3 +24,8 @@ commands =
sh -c "ansible-galaxy install git+file://$(pwd),$(git rev-parse --abbrev-ref HEAD) -p .molecule/roles" sh -c "ansible-galaxy install git+file://$(pwd),$(git rev-parse --abbrev-ref HEAD) -p .molecule/roles"
molecule dependency molecule dependency
pre-commit run --all-files pre-commit run --all-files
[testenv:import]
envdir = {toxinidir}/.tox/molecule
deps = -rtests/requirements.txt
commands = ansible-galaxy import -v
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment