# How do you store login info only once?

**URL:** <https://forum.ansible.com/t/how-do-you-store-login-info-only-once/16156>\
**Category:** Ansible Project\
**Created:** [September 9, 2014, 10:55am UTC](https://forum.ansible.com/t/how-do-you-store-login-info-only-once/16156 "2014-09-09T10:55:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hagai\_Kariti](https://avatars.discourse-cdn.com/v4/letter/h/4491bb/32.png) [@Hagai\_Kariti](https://forum.ansible.com/u/Hagai_Kariti)\
**Post date:** [September 9, 2014, 10:55am UTC](https://forum.ansible.com/t/how-do-you-store-login-info-only-once/16156/1 "2014-09-09T10:55:50Z")

</div>

Hi all  
I have a pattern question. Let’s say I use ansible to both provision a server (RabbitMQ in my case) and to deploy an application that will connect to that server. Of course I save the login info in a vaulted group\_vars file.  
However, since the server and the application run on different servers and are on different hostgroups, I need to save the login info twice - once in the rabbit group\_var and once in the app group\_var.

There are several ways to solve this - I can put it once in the `all’ group, create a 3rd hostgroup for ‘rabbitmq related’ servers, put the login info in an external file and include that… Any preference you guys have?

Thanks!

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [September 9, 2014, 4:46pm UTC](https://forum.ansible.com/t/how-do-you-store-login-info-only-once/16156/2 "2014-09-09T16:46:08Z")

</div>

The larger group could work. vars\_files could be a good thing too.

vars\_files:

- rabbit\_login\_info.yml

etc

I tend to use group\_vars pretty heavily, because they are automatically loaded.

---

<div class="post-metadata">

**Author:** ![Hagai\_Kariti](https://avatars.discourse-cdn.com/v4/letter/h/4491bb/32.png) [@Hagai\_Kariti](https://forum.ansible.com/u/Hagai_Kariti)\
**Post date:** [September 9, 2014, 4:52pm UTC](https://forum.ansible.com/t/how-do-you-store-login-info-only-once/16156/3 "2014-09-09T16:52:39Z")

</div>

Yeah I prefer groupvars for that reason too. I just put it in the ‘all’ group for now, felt less cumbersome than dealing with static group relations.  
Thanks for the reply 🙂
