Effective environment / hostgroup usage for multi-node environments

Hi All,

I'm trying to create structures like this:

Environment A Environment B
> > / |
Apache MySQL Varnish Apache MySQL
Hostgroup Hostgroup Hostgroup Hostgroup Hostgroup
> > / |
Frontend Database Cache Frontend Database
server server server server server

Naturally, each of these servers then needs access to a global set of
environment variables to be used for configuration. (eg, cache server needs
to know where its apache servers are)

There are a number of ways something like this could be achieved, but none
of them feel like Best Practice:

  1. Create multiple Environments, clone hostgroups, and assign the
    related environments. This is not DRY.
  2. Use domains to differentiate environments, which *can have *variables
    attached.
  3. Clone hostgroups, assign a custom module to a common parent
    hostgroup, override smart params for host lookup. Again, not DRY.

most of my issue here is with why environments cant have variables, and why
hostgroups need to be bound to environments - shouldn't they be independent?

Chef can do this with environment definitions, which can also be duplicated
easily, and are independent of roles (hostgroups), surely Puppet and
Foreman can do something similar?

I feel like I'm missing something obvious here.

any commentary would be greatly appreciated!

> Hi All,
>
> I'm trying to create structures like this:
>
> Environment A Environment B
> > > / |
> Apache MySQL Varnish Apache MySQL
> Hostgroup Hostgroup Hostgroup Hostgroup Hostgroup
> > > / |
> Frontend Database Cache Frontend Database
> server server server server server
>
> Naturally, each of these servers then needs access to a global set of
> environment variables to be used for configuration. (eg, cache server needs
> to know where its apache servers are)
>
>
> There are a number of ways something like this could be achieved, but none
> of them feel like Best Practice:
>
> 1. Create multiple Environments, clone hostgroups, and assign the
> related environments. This is not DRY.
> 2. Use domains to differentiate environments, which *can have *variables
> attached.
> 3. Clone hostgroups, assign a custom module to a common parent
> hostgroup, override smart params for host lookup. Again, not DRY.
>
>
> most of my issue here is with why environments cant have variables, and
> why hostgroups need to be bound to environments - shouldn't they be
> independent?
>
> Chef can do this with environment definitions, which can also be
> duplicated easily, and are independent of roles (hostgroups), surely Puppet
> and Foreman can do something similar?
>
> I feel like I'm missing something obvious here.
>
> any commentary would be greatly appreciated!
>

Did you consider having a smart var for this?

you could do a match order based on a combination, e.g. hostgroup,
environment

then

match is environment = A, hostgroup = mysql
value …

Ohad

··· On Fri, Feb 14, 2014 at 9:43 AM, Rowcliffe Browne wrote:


You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/groups/opt_out.

That would make sense, but my question is, as best practice, where do you
put it?

on a hostgroup, and your cloning and parenting to make your smart vars
available to all servers?
on a domain?

Neither feel like work arounds, not the correct solution.

rowy.

··· On Saturday, February 15, 2014 5:24:27 AM UTC+8, ohad wrote: > > > > > On Fri, Feb 14, 2014 at 9:43 AM, Rowcliffe Browne <rbkb...@gmail.com > > wrote: > >> Hi All, >> >> I'm trying to create structures like this: >> >> Environment A Environment B >> > > / | \ >> Apache MySQL Varnish Apache MySQL >> Hostgroup Hostgroup Hostgroup Hostgroup Hostgroup >> > > / | \ >> Frontend Database Cache Frontend Database >> server server server server server >> >> Naturally, each of these servers then needs access to a global set of >> environment variables to be used for configuration. (eg, cache server needs >> to know where its apache servers are) >> >> >> There are a number of ways something like this could be achieved, but >> none of them feel like Best Practice: >> >> 1. Create multiple Environments, clone hostgroups, and assign the >> related environments. This is not DRY. >> 2. Use domains to differentiate environments, which *can have *variables >> attached. >> 3. Clone hostgroups, assign a custom module to a common parent >> hostgroup, override smart params for host lookup. Again, not DRY. >> >> >> most of my issue here is with why environments cant have variables, and >> why hostgroups need to be bound to environments - shouldn't they be >> independent? >> >> Chef can do this with environment definitions, which can also be >> duplicated easily, and are independent of roles (hostgroups), surely Puppet >> and Foreman can do something similar? >> >> I feel like I'm missing something obvious here. >> >> any commentary would be greatly appreciated! >> > > Did you consider having a smart var for this? > > you could do a match order based on a combination, e.g. hostgroup, > environment > > then > > match is environment = A, hostgroup = mysql > value ... > > Ohad > >> -- >> You received this message because you are subscribed to the Google Groups >> "Foreman users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to foreman-user...@googlegroups.com . >> To post to this group, send email to forema...@googlegroups.com >> . >> Visit this group at http://groups.google.com/group/foreman-users. >> For more options, visit https://groups.google.com/groups/opt_out. >> > >