ansible-test and roles variables.

Hi, I’m trying to use Ansible Test to build an integration test and have a few questions.

  • I read a few topics about the integration-config.yml file. What can I put in this file? Is there any documentation about it?

  • I have some roles to test with variables declared in them. How can I use these variables in my tests? I don’t want to duplicate the variables declared inside the roles in the integration/targets folders. Is there any documentation about variable usage for Ansible Test?

Thanks a lot .

The inventory_config.yml file is loaded from tests/integration/integration_config.yml in collections. It can contain arbitrary variables. The only documentation I found seems outdated (those example templates no longer exist).

You can use role variables in your test targets by passing public: True to include_role, or by using import_role (which sets public to True by default). If you use include_role, those role variables will be available following that task. If you use import_role, the role variables will be available anywhere in the test target. Here’s some documentation on the differences between includes and imports.