Giter Club home page Giter Club logo

jinja2-ansible-test's Introduction

Role Name

I developed this role as a quick template for validating Jinja2 filters within an Ansible role. This is basically an implametation of the excelent article on Das Blinken Lichten

While there are probaly simpler ways to test jinja2 filters, I'm currently using them in Ansible, so I built a quick test infrastructure around it using Molecule.

Requirements

To run the test framework you will need :

  • Ansible
  • Molecule
  • Docker

(TODO: Test on a blank machine to see if anything is missing. Add a way to self install)

Role Variables

The role has no variables. It only contains filters in the filter_plugins directory.

Dependencies

None.

Example Playbook

By including the role, the filter is loaded and can be used.

    - hosts: servers
      roles:
         - role: jinja2-ansible-test

TODO: Confirm this.

Usage

The framework uses molecule to build and test the different use cases for the role. As stated above, I'm sure there is a better way to test Jinja2 filters, it is just that I have been using molecule to test things.

Overall testing is done by molecule test

The individual steps are molecule create to create the docker image, ,molecule converge to run molecule/default/playbook.yml against the image , and molecule verify to run the tests against the image.

The test cases need to be written into the molecule/default/test/test_default.py using the TestInfra framework.

License

BSD

Author Information

Author of the filter : JON LANGEMAK ( http://www.dasblinkenlichten.com/ ) Author of the role/test framework: Alain Chiasson ( https://github.com/alainchiasson/jinja2-ansible-test )

jinja2-ansible-test's People

Contributors

alainchiasson avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

swipswaps

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.