How do you store login info only once?

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!

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.

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 :slight_smile: