How to Segregate Inventory file and Group Variable to provide Ansible User name and password

Guys,

I am new in Ansible and need some help. I am in need of segregating my inventory file (which will change continuously based on another script output) with credential file. However Ansible username, password and admin password will be same or static. I want to create a group variable file to store credential and that should be encrypted using vault.

Can you give some direction to hook my group variable file to inventory file in Ansible playbook

Regards,

Guys,

I am new in Ansible and need some help. I am in need of segregating my inventory file (which will change continuously
based on another script output) with credential file. However Ansible username, password and admin password will be same
or static. I want to create a group variable file to store credential and that should be encrypted using vault.

Can you give some direction to hook my group variable file to inventory file in Ansible playbook

You can have separate files for your "main" inventory and group variables.

Let's say your inventory is "production", you can set it up like that:

production/production.yml => "main" inventory
production/group_vars/mygroup.yml => contains group variables

You can encrypt your group variable file with:

ansible-vault encrypt production/group_vars/mygroup.yml

Given that your "main" inventory changes dynamically, check out these resources:

https://docs.ansible.com/ansible/latest/user_guide/intro_dynamic_inventory.html
https://docs.ansible.com/ansible/latest/dev_guide/developing_inventory.html

Regards
        Racke

Thanks Racke,
It is solved now.:blush:

Regards,
Souvik