Hi Dirk,

That's a good idea, thanks.  In our case we have a lot of legacy hosts and 
no good naming convention - combined with an eye to a future of cloud-bases 
services (with undefined hostnames), and I think in our case that approach 
won't be maintainable.
A good solution without those constraints though.


Gareth


On Friday, January 29, 2016 at 12:26:49 PM UTC, Dirk Heinrichs wrote:
>
> Am 29.01.2016 um 13:03 schrieb Gareth Humphries:
>
> Any ideas?
>
>
> Can you derive the role from the hostname? I do something similar to 
> determine the location of a machine based on IP address range. So I have 
> lib/facter/location.rb in one of my modules, with the following content:
>
> # Set location of a host by examining its IP address
>
> Facter.add(:location) do
>     setcode do
>         address = Facter.value(:ipaddress)
>         case address
>         when /^10\.11\.\d+\.\d+$/
>             'Here'
>         when /^10\.12\.\d+\.\d+$/
>             'There'
>         when /^10\.13\.\d+\.\d+$/
>             'Somewhere Else'
>         else
>             'Unknown Location'
>         end
>     end
> end
>
> You could derive the role fact from the hostname, if you name your 
> machines after their purpose.
>
> HTH...
>
>     Dirk
> -- 
>
> *Dirk Heinrichs*, Senior Systems Engineer, Engineering Solutions
> *Recommind GmbH*, Von-Liebig-Straße 1, 53359 Rheinbach
> *Tel*: +49 2226 1596666 (Ansage) 1149
> *Email*: d...@recommind.com <javascript:>
> *Skype*: dirk.heinrichs.recommind
> www.recommind.com
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/792c6177-5413-4222-8bd4-7f68394fbee4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to