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.