MikeCaspar.testForFolder
testForFolder
=============================
testForFolder (test/confirm folder)
This tool is meant to be used with the maintain/test process shown at AnsibleFest 2016 in San Francisco.
Test roles are designed to run in read-only mode (to check if something is correctly set up or not).
If you want to try this tool on a different platform, please make a Pull Request for it or email me to see if it can be added.
You can read the original slides about the test/maintain process here.
The tests in this process are created using a _test.yml file that you can run separately from the _maintain playbooks.
This way, you can test things first and also use _test.yml as a way to check compliance.
To help people who want to use this method, I've shared some pre-defined example roles so you don't have to start from scratch.
The goal is to let teams work on infrastructure using existing Ansible YAML syntax without needing to learn Python programming.
Requirements
You need a working Ansible installation version 1.9 or higher.
Role Variables
- path (string) - Required
- expected (string) - Required (must be either "present" or "absent")
- debug: (true/false) - Shows variable details as it goes (defaults to false)
- immediate_exit_on_fail: (true/false) - Fails immediately if there's an error (defaults to false)
Dependencies
No dependencies.
Example Playbook
To check if "/etc/" is present on the system:
# playbook: application1_proxy_test.yml
- hosts: servers
roles:
- { role: MikeCaspar.testForFolder, path:"/etc", expected: present }
To check if "/etc/" is absent on the system:
# playbook: application1_proxy_test.yml
- hosts: servers
roles:
- { role: MikeCaspar.testForFolder, path:"/etc", expected: absent, debug: true }
License
MIT
Author Information
This tool was created in 2016 by Mike Caspar.
Playbook test role for _test/_maintain loop - testForFolder
ansible-galaxy install MikeCaspar.testForFolder