MikeCaspar.testForTimezone
testForTimezone
testForTimezone (tests/validates timezone setting)
This role is meant to be used with the maintain_ / test_ loop introduced at AnsibleFest 2016 in San Francisco.
Test roles are designed to run in read-only mode (to confirm successful or unsuccessful test outcomes)
If you want to try this role on a different platform, please submit a Pull Request for that platform, or feel free to email me to request its addition.
You can read the original slides on the test/maintain loop here.
Tests in this part of the loop are created using a _test.yml file that can run separately from _maintain playbooks.
This allows for a test-first/test-parallel approach while also using _test.yml as a governance check tool.
To help those who want to use this method, I've decided to share predefined example roles, so you don’t have to start from zero.
The goal is to enable teams working on infrastructure to use existing Ansible YAML syntax without needing to learn Python coding.
Requirements
You need a working Ansible installation version 1.9 or above.
Role Variables
- timezoneCity (string) - Required
- debug: (true/false) - Option to show variable debug information as it runs (default is false)
- immediate_exit_on_fail: (true/false) - Option to stop immediately if there’s a failure (default is false)
Dependencies
No dependencies.
Example Playbook
To test/confirm that "America/Toronto" is set as the current Timezone City:
# playbook: application1_proxy_test.yml
- hosts: servers
roles:
- { role: MikeCaspar.testForTimezone, timezoneCity:"America/Toronto" }
License
MIT
Author Information
This role was created in 2016 by Mike Caspar.
Playbook test role for _test/_maintain loop - testForTimezone
ansible-galaxy install MikeCaspar.testForTimezone