Commit 2571354c authored by nimrod's avatar nimrod
Browse files

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

# Conflicts:
#	.gitignore
#	.pre-commit-config.yaml
#	.travis.yml
#	meta/main.yml
#	tasks/main.yml
parents acb13ae1 d1c54835
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -9,5 +9,6 @@ __pycache__
.vagrant/
*.log
*.retry
.tox
tests/files/id_rsa
tests/files/id_rsa.pub
+9 −21
Original line number Diff line number Diff line
-   repo: https://github.com/pre-commit/pre-commit-hooks
    sha: 7539d8bd1a00a3c1bfd34cdb606d3a6372e83469
    sha: v0.7.1
    hooks:
    -   id: check-added-large-files
    -   id: check-json
@@ -9,31 +9,19 @@
    -   id: flake8
    -   id: check-symlinks
-   repo: https://github.com/adarnimrod/ansible-pre-commit.git
    sha: v0.5.0
    sha: v0.6.0
    hooks:
    -   id: ansible-syntax-check
        always_run: true
        files: tests/playbook.yml
        args:
        - tests/playbook.yml
-   repo: https://github.com/adarnimrod/shell-pre-commit
    sha: v0.1.0
    hooks:
    -   id: shell-lint
-   repo: https://github.com/willthames/ansible-lint
    sha: 959ab0f525e9abb19cf75f34381015cf33695f61
    sha: v3.4.13
    hooks:
    -   id: ansible-lint
        always_run: true
        files: tests/playbook.yml
        args:
        - tests/playbook.yml
-   repo: local
-   repo: https://github.com/adarnimrod/python-pre-commit.git
    sha: v0.2.0
    hooks:
    -   id: piprot
        name: piprot
        description: Check up-to-date Python requirements
        language: system
        entry: piprot --outdated tests/requirements.txt
        files: requirements.txt
        always_run: true
-   repo: https://github.com/adarnimrod/shell-pre-commit
    sha: v0.1.0
    hooks:
    -   id: shell-lint
+27 −20
Original line number Diff line number Diff line
---
language: python
python: ["2.7", "3.5"]
python: "2.7"
dist: trusty
sudo: True
group: beta
env:
    - platform: openbsd60
    - &openbsd59 platform=openbsd59
    - platform: xenial
    - platform: trusty
    - platform: precise
    - &stretch platform=stretch
    - platform: jessie
    - platform: wheezy
    global:
        - VBOX_MEMORY=2048
        - VBOX_HWVIRTEX=off
    matrix:
    fast_finish: True
    allow_failures:
        - python: "3.5"
        - env: *openbsd59
        - env: *stretch
        - TOXENV=openbsd60
        - TOXENV=xenial
        - TOXENV=trusty
        - TOXENV=precise
        - &stretch TOXENV=stretch
        - &jessie TOXENV=jessie
        - TOXENV=wheezy

cache:
  - pip
  - directories:
@@ -29,14 +27,23 @@ install:
  - 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
  - sudo dpkg -i vagrant_1.9.1_x86_64.deb
  - pip install -r tests/requirements.txt | cat
  - ansible-galaxy install git+file://$(pwd),$(git rev-parse --abbrev-ref HEAD) -p .molecule/roles
  - molecule dependency
  - &pip_install pip install tox-travis | cat

script:
  - pre-commit run --all-files
  - travis_wait 45 molecule test --platform $platform
  - travis_wait 45 tox

notifications:
  webhooks: https://galaxy.ansible.com/api/v1/notifications/
  email: false
  on_failure: never

matrix:
    fast_finish: True
    allow_failures:
        - env: *stretch
    include:
        - env:
            TOXENV: pre-commit
          install:
              - *pip_install
          sudo: False

Jenkinsfile

0 → 100644
+38 −0
Original line number Diff line number Diff line
/*
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'
        }
    }
}
+3 −15
Original line number Diff line number Diff line
@@ -30,21 +30,9 @@ See :code:`tests/playbook.yml`.
Testing
-------

Testing requires Python 2.7, Vagrant and Virtualbox. Install the Python
dependencies, dependent roles and roles required for testing:

.. code:: shell

    pip install -r tests/requirements.txt
    ansible-galaxy install git+file://$(pwd),$(git rev-parse --abbrev-ref HEAD) -p .molecule/roles
    molecule dependency

To run the full test suite:

.. code:: shell

    pre-commit run --all-files
    molecule test --platform all
Testing requires Python 2.7, Tox, Vagrant and Virtualbox. To test simply run
:code:`tox`. `Pre-commit <http://pre-commit.com/>`_ is also setup for this
project.

License
-------
Loading