On 12/01/2015 17:10, Stefan G. Weichinger wrote:
> On 11.01.2015 17:36, Alan McKinnon wrote:
> 
>> The trick is to use a system that guarantees you a unique "label" or
>> identifier for each host.
>>
>> Perhaps {{ customer_name }}/{{ hostname }} works?
>>
>> This would fail if you have two customers with the same company name
>> (rare, but not impossible) or customers have machines with the same name
>> (silly, but possible). In that case, you'd probably have to go with
>> UUIDs or similar.
> 
> Where do I get
> 
> {{ customer_name }}
> 
> from?
> 
> Where to define or set?
> 
> example?


You'd have to define it yourself in your plays somewhere

Several ways present themselves:

- Group customers together by customer name and use the group name.

- Define the customer directly in the inventory. Generally it isn't
recommended to define variable there, but I think this is one of the few
case where it does make sense. Sort of like this:

acme_web_server        ansible_ssh_host=1.2.3.4  customer=acme

{{ customer }} then is available for that host whenever the host is in scope



One thing you'll find with ansible is there's always a way to do
something, often more than one way (like perl). And all ways often make
sense (unlike perl)


-- 
Alan McKinnon
alan.mckin...@gmail.com


Reply via email to