This document describes the various configuration options available in the Ansible PlayTest framework.
The scenario configuration directory is where the framework looks for test scenarios and related data. You can specify this directory in three ways:
When using the CLI tool, you can specify the config directory using the --config-dir option:
ansible-playtest path/to/playbook.yml --scenario my_scenario --config-dir /path/to/my/configYou can set the ANSIBLE_PLAYTEST_CONFIG_DIR environment variable:
export ANSIBLE_PLAYTEST_CONFIG_DIR="/path/to/my/config"
ansible-playtest path/to/playbook.yml --scenario my_scenarioWhen using the framework in your own Python code, you can use the set_config_dir class method:
from ansible_playtest.core.ansible_test_scenario import AnsibleTestScenario
# Set the config directory
AnsibleTestScenario.set_config_dir('/path/to/my/config')
# Now load scenarios or run tests
# ...If no configuration directory is specified, the framework uses a default directory within the package, typically:
<package_install_path>/ansible_playtest/tests/test_data
Within the configuration directory, scenarios are expected to be in a scenarios subdirectory:
config_dir/
├── scenarios/
│ ├── scenario1.yaml
│ ├── scenario2.yml
│ └── subdir/
│ └── scenario3.yaml
└── other_test_data/
- SMTP Server: Configure using
--smtp-portor disable with--no-smtp - Debugging: Keep mock files after execution with
--keep-mocks