When wanting to namespace variables in a role, is it typical to use a hash, or a prefix? Is there a best practice for this?
e.g.
role_name_var_one: 1
role_name_var_two: 2
role_name_var_three: 3
or
role_name:
var_one: 1
var_two: 2
var_three: 3
When wanting to namespace variables in a role, is it typical to use a
hash, or a prefix? Is there a best practice for this?
There are pros and cons either way. Off the top of my head, using a hash
lets you iterate over it easily, and IMHO looks nicer; but you can't (as
far as I know) add elements to it in different places in your inventory.
If you have a hash of elements that you want defined on all hosts, and you
then want to add another element to be defined only on a particular group
of hosts, I don't think there's a way to do that. That's easy with
prefixes; but then it's harder to loop through the prefix-ed variables.
-Josh (jbs@care.com)
(apologies for the automatic corporate disclaimer that follows)
This email is intended for the person(s) to whom it is addressed and may contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized use, distribution, copying, or disclosure by any person other than the addressee(s) is strictly prohibited. If you have received this email in error, please notify the sender immediately by return email and delete the message and any attachments from your system.