This repository has been archived by the owner on May 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
71 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,13 @@ | ||
Testible | ||
======== | ||
|
||
An example how to test playbooks and roles with virtualbox vms | ||
[![Documentation Status](https://readthedocs.org/projects/testible/badge/?version=latest)](http://testible.readthedocs.io/en/latest/?badge=latest) | ||
|
||
Quick start | ||
----------- | ||
Playbooks to start and stop virtualbox vms and test your playbooks. | ||
|
||
1. Copy testible-playbook.yml file in your ansible projet in the same | ||
folder than your playbooks. | ||
2. Set variables host vars for localhost and virtualbox vm host | ||
3. Run this command | ||
```shell | ||
ansible-playbook testible-playbook.yml --extra-vars='{"vm": "name of vm", "snapshot": "name of snapshot", "playbook": "name of playbook"}' | ||
``` | ||
Test playbook use **localhost** host. It sets the vm at the snapshot and | ||
launch the vm. It includes your playbook defined in *playbook* extra | ||
vars. | ||
|
||
You need to define vm and snapshot uuid, it is explained below. | ||
|
||
Configure localhost | ||
------------------- | ||
|
||
First you need virtualbox and install at least one vm. | ||
|
||
Based on [ansible best | ||
practices](http://docs.ansible.com/ansible/playbooks_best_practices.html), | ||
this example use the directory layout. So variables needed for localhost | ||
are located on *host\_vars/localhost*. The file is commented. The | ||
testible playbook can sit along your project playbook. | ||
|
||
The script need your local user in var to configure *$HOME/.ssh/config* | ||
file. The playbook add an entry for the test vm at the start and delete | ||
the entry when it quits. | ||
```yaml | ||
host: | ||
user: | ||
local: name of your local user | ||
``` | ||
|
||
Configure vm | ||
Useful links | ||
------------ | ||
|
||
For each vm choose a name. Add it to your inventory file and define | ||
variables in *host\_vars/name\_of\_hosts*. | ||
|
||
To get your vm uuid, run : | ||
```shell | ||
$ VBoxManage list vms | ||
``` | ||
|
||
In your host var file add this var | ||
```yaml | ||
host: | ||
vbox: | ||
uuid: vmuuid | ||
``` | ||
To get your vm snapshots, run : | ||
```shell | ||
$ VBoxManage snapshot vmuuid list | ||
``` | ||
In your host var file add this var. | ||
```yaml | ||
host: | ||
name: your host name | ||
vbox: | ||
uuid: vbox_uuid | ||
snapshots: | ||
bare_minimal: snapshotuuid | ||
``` | ||
Take a look at host\_vars files ;) | ||
[Documentation](http://testible.readthedocs.io/en/latest/) | ||
[Issue tracking](https://github.com/ioO/testible/issues) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,72 @@ | ||
.. Testible documentation master file, created by | ||
sphinx-quickstart on Wed Oct 18 14:08:49 2017. | ||
You can adapt this file completely to your liking, but it should at least | ||
contain the root `toctree` directive. | ||
Testible | ||
======== | ||
|
||
Welcome to Testible's documentation! | ||
==================================== | ||
An example how to test playbooks and roles with virtualbox vms | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: Contents: | ||
Quick start | ||
----------- | ||
|
||
1. Copy testible-playbook.yml file in your ansible projet in the same | ||
folder than your playbooks. | ||
2. Set variables host vars for localhost and virtualbox vm host | ||
3. Run this command | ||
```shell | ||
ansible-playbook testible-playbook.yml --extra-vars='{"vm": "name of vm", "snapshot": "name of snapshot", "playbook": "name of playbook"}' | ||
``` | ||
Test playbook use **localhost** host. It sets the vm at the snapshot and | ||
launch the vm. It includes your playbook defined in *playbook* extra | ||
vars. | ||
|
||
You need to define vm and snapshot uuid, it is explained below. | ||
|
||
Indices and tables | ||
================== | ||
Configure localhost | ||
------------------- | ||
|
||
* :ref:`genindex` | ||
* :ref:`modindex` | ||
* :ref:`search` | ||
First you need virtualbox and install at least one vm. | ||
|
||
Based on [ansible best | ||
practices](http://docs.ansible.com/ansible/playbooks_best_practices.html), | ||
this example use the directory layout. So variables needed for localhost | ||
are located on *host\_vars/localhost*. The file is commented. The | ||
testible playbook can sit along your project playbook. | ||
|
||
The script need your local user in var to configure *$HOME/.ssh/config* | ||
file. The playbook add an entry for the test vm at the start and delete | ||
the entry when it quits. | ||
```yaml | ||
host: | ||
user: | ||
local: name of your local user | ||
``` | ||
|
||
Configure vm | ||
------------ | ||
|
||
For each vm choose a name. Add it to your inventory file and define | ||
variables in *host\_vars/name\_of\_hosts*. | ||
|
||
To get your vm uuid, run : | ||
```shell | ||
$ VBoxManage list vms | ||
``` | ||
|
||
In your host var file add this var | ||
```yaml | ||
host: | ||
vbox: | ||
uuid: vmuuid | ||
``` | ||
To get your vm snapshots, run : | ||
```shell | ||
$ VBoxManage snapshot vmuuid list | ||
``` | ||
In your host var file add this var. | ||
```yaml | ||
host: | ||
name: your host name | ||
vbox: | ||
uuid: vbox_uuid | ||
snapshots: | ||
bare_minimal: snapshotuuid | ||
``` | ||
Take a look at host\_vars files ;) |