The goal of this project is to test your ansible system automation. Its goal is basically to test ansible roles, but role_unit’s own tests are an example of an other usage that can be made.
-
docker
-
ansible
To create a new role tested with role_unit, place yourself in the directory where you want the role and run role_unit:
cd /my/ansible/dir/roles /path/to/role_unit my_role
This will create an empty role with the testing tools in the tests directory. A default tests file is created that run on the default container (debian9). To adapt the used distribution set the RU_ENV_IMAGE variable (see below).
You have a list of functions you can call in your test file, described below.
Initiates testing environment, i.e. creates containers or virtual machines depending on configuration.
Runs the specified command on all of the servers or just on the one specified. N is the number of the server you want to run the command on.
Plumb_unit behaviour can be changed using environment variables: * RU_ENV_NAME defines the testing environment name. It is the name of the role you will test. * RU_ENV_IMAGE defines the system image used to create test environment. * RU_COUNT sets the number of containers or virtual machines