From d3938f13f116e4400d8d955eb431890ac39ddc4f Mon Sep 17 00:00:00 2001 From: Ygal Blum Date: Tue, 17 Oct 2023 20:47:29 +0300 Subject: [PATCH] Move ansible.cfg to tests (#20) Move the cfg file to avoid collisions Add README for testing Signed-off-by: Ygal Blum --- tests/README.md | 39 ++++++++++++++++++++++++++++++++ ansible.cfg => tests/ansible.cfg | 2 +- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 tests/README.md rename ansible.cfg => tests/ansible.cfg (81%) diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 0000000..1625a4b --- /dev/null +++ b/tests/README.md @@ -0,0 +1,39 @@ +# Testing the LVM Snapshot Role + +## Prerequisites + +- All the tests are in the form of ansible playbooks. +- All playbooks expect that the target machine will have a secondary storage device to be used for testing. + +## Variables +The variables may be passed as part of the inventory or using a separate file. + +```yaml +device: < device node without `/dev`. e.g. vdb > +``` + +## Ansible Configuration + +In order to run the tests from the repo without having to install them, +the tests directory includes an [ansible.cfg](./ansible.cfg) file. +Make sure to point to it when running the test playbook + +## Running a test + +### Inventory file + +In this example, the `device` parameter is passed in the `inventory.yml` file +```yaml +all: + hosts: + : + device: vdb +``` + +### Command line + +Running the [snapshot revert playbook](./test-revert-playbook.yml) test from the repo + +```bash +ANSIBLE_CONFIG=./tests/ansible.cfg ansible-playbook -K -i inventory.yml tests/test-revert-playbook.yml +``` diff --git a/ansible.cfg b/tests/ansible.cfg similarity index 81% rename from ansible.cfg rename to tests/ansible.cfg index 8baa967..0721554 100644 --- a/ansible.cfg +++ b/tests/ansible.cfg @@ -1,2 +1,2 @@ [defaults] -roles_path=~/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:./roles +roles_path=~/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:../roles