Code Monkey home page Code Monkey logo

goss-ansible's Introduction

ansible-goss

CI

Launch Goss test file with Ansible.

Installation

Copy the goss.py file into your Ansible library directory. That's it!

Quick start

Simple example

Validate a Goss test file (the test file must be on the remote machine):

- name: test goss file
  goss:
    path: "/path/to/file.yml"

If a test fails, the module returns an error. If you want to ignore this error, add ignore_errors: yes on the task.

Output format and output file

You can change the output format with the format option:

- name: test goss file
  goss:
    path: "/path/to/file.yml"
    format: json

See all the supported output format: https://github.com/aelsabbahy/goss#supported-output-formats

You can also save the output of the goss command in a file with the output_file option:

- name: test goss file
  goss:
    path: "/path/to/file.yml"
    format: json
    output_file : /my/output/file.json

Changed = False

We use this module for testing/validation purposes. Therefore, this module always returns changed = false, even with the output_file option.

Ansible versions

Tested with :

  • Ansible 1.8.2
  • Ansible 2.0.2
  • Ansible 2.2.2

Module documentation

module: goss
author: Mathieu Corbin
short_description: Launch goss (https://github.com/aelsabbahy/goss) tests
description:
  - Launch goss tests.
    This module always returns `changed = false` for idempotence.
options:
  path:
    required: true
    description:
      - Test file to validate.
        The test file must be on the remote machine.
  goss_path:
    required: false
    description:
      - Path location for the goss executable.
        Default is "goss" (ie.`no absolute path,  goss executable must be available in $PATH).
  format:
    required: false
    description:
      - Output goss format.
        Goss format list : goss v --format => [documentation json junit nagios nagios_verbose rspecish tap silent].
        Default is "rspecish".
  output_file:
    required: false
    description:
      - Save the result of the goss command in a file whose path is output_file

examples:
  - name: run goss against the gossfile /path/to/file.yml
    goss:
      path: "/path/to/file.yml"

  - name: run goss against the gossfile /path/to/file.yml with nagios output
    goss:
      path: "/path/to/file.yml"
      format: "nagios"

  - name: run /usr/local/bin/goss against the gossfile /path/to/file.yml
    goss:
      path: "/path/to/file.yml"
      goss_path: "/usr/local/bin/goss"

  - name: run goss against multiple gossfiles and write the result in JSON format to /my/output/ for each file
    goss:
      path: "{{ item }}"
      format: json
      output_file : /my/output/{{ item }}
    with_items: "{{ goss_files }}"

goss-ansible's People

Contributors

bbaassssiiee avatar ggrossetie avatar loliee avatar mcorbin avatar petemounce avatar xengi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

goss-ansible's Issues

Can I link to this in the goss readme?

I was wondering what the current state of this project is. If it's in a working state, would you mind if I link to this from the goss readme?

Thanks for building this :)

pylint warnings

library/goss.py:1:0: C0114: Missing module docstring (missing-module-docstring)
library/goss.py:88:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
library/goss.py:92:0: C0116: Missing function or method docstring (missing-function-docstring)
library/goss.py:119:4: C0103: Variable name "rc" doesn't conform to snake_case naming style (invalid-name)
library/goss.py:119:13: W0612: Unused variable 'err' (unused-variable)

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.