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

22 views
Skip to first unread message

ditun dhar

unread,
Jun 17, 2020, 11:07:27 AM6/17/20
to Ansible Project
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,

Stefan Hornburg (Racke)

unread,
Jun 17, 2020, 11:32:19 AM6/17/20
to ansible...@googlegroups.com
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

>
> Regards,
>
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> ansible-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/afd8dd60-269a-4f84-af2a-e979d5b051eao%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/afd8dd60-269a-4f84-af2a-e979d5b051eao%40googlegroups.com?utm_medium=email&utm_source=footer>.


--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

signature.asc

ditun dhar

unread,
Jun 18, 2020, 2:56:54 PM6/18/20
to ansible...@googlegroups.com
Thanks Racke,
It is solved now.😊

Regards,
Souvik

To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/2357b241-52db-c02b-d8bc-fdcbd3b47d13%40linuxia.de.
Reply all
Reply to author
Forward
0 new messages