ssato.nw_test_existence_by_regex
=================================== ssato.nw_test_existence_by_regex ===================================
.. image:: https://img.shields.io/travis/ssato/ansible-role-nw-test-existence-by-regex.png :target: https://travis-ci.org/ssato/ansible-role-nw-test-existence-by-regex :alt: [Test Status]
.. image:: https://img.shields.io/ansible/role/44621.svg :target: https://galaxy.ansible.com/ssato/nw_test_existence_by_regex :alt: [Ansible Galaxy]
This is an Ansible role designed to check if specific items exist in network nodes.
The role has three modes based on the rntebr_mode
variable (default: normal):
normal: This mode runs a command on the target network nodes to check for the presence of items using regex patterns. If the variable
rntebr_targets_should_be_found
is set to false, it will check that these items are not found.dump: This mode executes a command on the target network nodes and saves the results as a JSON file in a specified format.
dryrun: This mode simulates the execution without actually running the command on the target nodes. It is useful for testing if the regex patterns match the expected results.
Requirements
- Python modules needed for the Ansible network modules you are using.
Role Variables
You can customize the following variables for your needs:
rntebr_mode: Can be set to 'dump', 'dryrun', or any string that includes 'normal'.
- Use 'dump' if you want to save the command output.
- Use 'dryrun' if you only want to test if regex patterns match with reference data (you need to have this data ready).
- Use 'normal' or any other string if you want to execute commands and check for items.
rntebr_targets_patterns: Regex patterns for locating target items in the command output.
rntebr_res: Set results when in 'dryrun' mode.
rntebr_dump_path: File path for output in 'dump' mode.
rntebr_command: Command to run on the network nodes when not in 'dryrun' mode.
Most other variables do not need customization.
Refer to defaults/main.yml for the default values of each variable and tests/files/evars.yml for more details.
Example Playbook
See tests/playbook.yml for an example.
License
MIT
Author
Satoru SATOH ssato@Github <https://github.com/ssato>
_
.. vim:sw=2:ts=2:et:
Test existence of target objects by regular expression in network nodes.
ansible-galaxy install ssato.nw_test_existence_by_regex