On Tue, 09 Jun 2015 08:29 -0700, richard kappler <[email protected]>
wrote:
> I have now named each server with a unique name, right? But in the 
> inventory docs it says: "The preferred practice in Ansible is actually
> not 
> to store variables in the main inventory file." and I agree. At some
> point 
> I will want to add more variables.
> So how would I set up a variable file such that it provides a name, based 
> on the IP being deployed to? and how do I reference that file in the 
> playbook so the plays know where to get the vars from? Sorry, very new at 
> all this.

I think you should try using the inventory_hostname variable for that.
It'll return those serverXX names you defined.

If you need more vars per host, I would use host_vars.

https://docs.ansible.com/playbooks_best_practices.html#group-and-host-variables

Giovanni

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1433867122.3028411.290962049.1E4EB4B1%40webmail.messagingengine.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to