# Integration testing with a single inventory configuration

**URL:** <https://forum.ansible.com/t/integration-testing-with-a-single-inventory-configuration/45239>\
**Category:** Get Help\
**Tags:** inventory\
**Created:** [February 2, 2026, 1:11pm UTC](https://forum.ansible.com/t/integration-testing-with-a-single-inventory-configuration/45239 "2026-02-02T13:11:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sankar\_Kumar](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sankar_kumar/32/10268_2.png) [@Sankar\_Kumar](https://forum.ansible.com/u/Sankar_Kumar)\
**Post date:** [February 2, 2026, 1:11pm UTC](https://forum.ansible.com/t/integration-testing-with-a-single-inventory-configuration/45239/1 "2026-02-02T13:11:50Z")

</div>

I am trying to write an integration test for custom API automation modules.  
here is the scenario,  
I have a server where my application is deployed with all the api’s (Mostly one server always).  
While writing integration testing, I want to mention the server IP, username, and password in a single inventory file. But Ansible accepts only the inventory file configuration for every task. How to resolve this?

Here I have given the individual API related details for every task, server ip and authentication details.  
Actual currently working:  
ansible\_collections/ansible\_modules/tests/integration/targets/personal\_info/tasks/main.yml  
ansible\_collections/ansible\_modules/tests/integration/targets/personal\_info/inventory\_vars.yml  
ansible\_collections/ansible\_modules/tests/integration/targets/work\_details/tasks/main.yml  
ansible\_collections/ansible\_modules/tests/integration/targets/work\_details/inventory\_vars.yml

Here I am trying to give one common file where I can fetch the serverIp  
Expecting:  
ansible\_collections/ansible\_modules/tests/integration/targets/personal\_info/tasks/main.yml  
ansible\_collections/ansible\_modules/tests/integration/targets/personal\_info/inventory\_vars.yml  
ansible\_collections/ansible\_modules/tests/integration/targets/work\_details/tasks/main.yml  
ansible\_collections/ansible\_modules/tests/integration/targets/work\_details/inventory\_vars.yml  
**ansible\_collections/ansible\_modules/tests/integration/targets/inventory\_vars.yml** – here I have given only one inventory file, which will be used to get the server details alone. So that whenever the server or user name password changed I can change it here alone.

---

<div class="post-metadata">

**Author:** ![chris](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chris/32/293_2.png) [@chris](https://forum.ansible.com/u/chris)\
**Post date:** [February 2, 2026, 2:54pm UTC](https://forum.ansible.com/t/integration-testing-with-a-single-inventory-configuration/45239/2 "2026-02-02T14:54:57Z")

</div>

> [@Sankar\_Kumar](#):
>
> I want to mention the server IP, username, and password in a single inventory file

It sounds like you are not using a YAML inventory file? If you use YAML you can do this, see:

> **[How to build your inventory — Ansible Community Documentation](https://docs.ansible.com/projects/ansible/latest/inventory_guide/intro_inventory.html)**

---

<div class="post-metadata">

**Author:** ![Sankar\_Kumar](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sankar_kumar/32/10268_2.png) [@Sankar\_Kumar](https://forum.ansible.com/u/Sankar_Kumar)\
**Post date:** [February 3, 2026, 3:21pm UTC](https://forum.ansible.com/t/integration-testing-with-a-single-inventory-configuration/45239/3 "2026-02-03T15:21:42Z")

</div>

Hi Chris,  
Thanks for the inputs, Actually I want to run `ansible-test integration`, not `ansible-playbook`. Do we have any way to run `ansible-test` with mentioning the inventory like this `ansible-test integration -i inventory.yml`?  
Regards,  
Sankar

---

<div class="post-metadata">

**Author:** ![chris](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chris/32/293_2.png) [@chris](https://forum.ansible.com/u/chris)\
**Post date:** [February 3, 2026, 3:49pm UTC](https://forum.ansible.com/t/integration-testing-with-a-single-inventory-configuration/45239/4 "2026-02-03T15:49:11Z")

</div>

I don’t know, I have never used `ansible-test`.

---

<div class="post-metadata">

**Author:** ![Sankar\_Kumar](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sankar_kumar/32/10268_2.png) [@Sankar\_Kumar](https://forum.ansible.com/u/Sankar_Kumar)\
**Post date:** [February 4, 2026, 5:39am UTC](https://forum.ansible.com/t/integration-testing-with-a-single-inventory-configuration/45239/5 "2026-02-04T05:39:07Z")

</div>

No problem. I have tried with `ansible_collections/ansible_modules/tests/integration/integration_config.yml`. This approach is working fine as expected for my scenario. `ansible-test integration` is working fine without any extra params passing while executing the command.

`ANSIBLE_INVENTORY=tests/integration/inventory.yml ansible-test integration <target_name>` – This is one more way of passing the inventory file while executing the command.
