Skip to content

Commit

Permalink
Move ansible.cfg to tests (#20)
Browse files Browse the repository at this point in the history
Move the cfg file to avoid collisions
Add README for testing

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
  • Loading branch information
ygalblum authored Oct 17, 2023
1 parent 74b44f5 commit d3938f1
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
39 changes: 39 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -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:
<FQDN of test machine>:
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
```
2 changes: 1 addition & 1 deletion ansible.cfg → tests/ansible.cfg
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit d3938f1

Please sign in to comment.