MikeCaspar.testForGroup
testForGroup
=============================
testForGroup (test/confirm group)
This tool is meant to be used with the maintain_ / test_ process introduced at AnsibleFest 2016 in San Francisco.
Test roles are designed to run in read-only mode (to check if something is working or not).
If you want to try this tool on a different platform, please submit a Pull Request for that platform or email me to request its addition.
You can see the original slides for the test/maintain process here.
Tests in this process are organized in a _test.yml file that can be run separately from _maintain playbooks.
This setup supports a "test first/test in parallel" approach and lets you use _test.yml as a way to check compliance.
To help those who want to use this approach, I’ve shared example roles for those who prefer not to start from scratch.
The goal is to enable infrastructure teams to work with existing Ansible YAML syntax without needing to learn Python.
Requirements
- Working Ansible installation (version 1.9 or higher)
Role Variables
- name: (string) - Required
- expected: (string) - Required - can be 'present' or 'absent'
- debug: (true/false) - Optionally shows debug info while it runs (defaults to false)
- immediate_exit_on_fail: (true/false) - Optionally exits right away if there’s a failure (defaults to false)
Dependencies
- No dependencies
Example Playbook
To check if the group "docker" exists:
# playbook: application1_proxy_test.yml
- hosts: servers
roles:
- { role: MikeCaspar.testForGroup, name: "docker" }
License
MIT
Author Information
This role was created in 2016 by Mike Caspar.
testForGroup
Playbook TDD/BDD style test role for _test/_maintain loop - testForGroup
ansible-galaxy install MikeCaspar.testForGroup