Every system can have multiple interfaces ( so, multiple mac,ip address etc 
)  . That is the reason

I have values of mac,ip, etc in the host_vars referenced in below playbook. 
https://github.com/ac427/my_cm/blob/master/ansible/playbooks/add_node



On Tuesday, April 12, 2016 at 12:58:30 PM UTC-4, thanstra wrote:
>
> I'm afraid I'm still a YAML newbie and that syntax still has me baffled.  
>
> I see the files in your hosts_var directory, but your variables are not 
> simply:
>
> label: var_value
>
> There seem to be a couple of extra layers and I don't follow why they are 
> there.  Why this:
>
> interfaces:
>   auto:
>     ip: ip_number
>
> Why the multiple layering?
>
> And then how are these found for use by the playbook? When I try something 
> similar, ansible complains that I don't have an inventory file.
>
> Sorry to be obtuse!
>
> On Tue, Apr 12, 2016 at 11:52 AM, ananta.c via Ansible Project <
> [email protected] <javascript:>> wrote:
>
>> for host related stuff you can put in host_vars 
>>
>> check this out https://github.com/ac427/my_cm/tree/master/ansible for 
>> reference to host_vars and group_vars 
>>
>>
>>
>> On Tuesday, April 12, 2016 at 11:39:36 AM UTC-4, thanstra wrote:
>>>
>>> I'm still missing the syntax and file naming for this.
>>>
>>> First off, can I create multiple files in group_vars and have them all 
>>> read? If so, what are the best naming conventions. Can I have names:
>>>
>>> host1.yml
>>> host2.yml
>>>
>>> etc. with a separate file for each host?
>>>
>>> And, if so, what does the content of the file look like?  I've tried 
>>> this in my host1.yml file:
>>>
>>> [host1]
>>> host.domain
>>>
>>> [host1:vars]
>>> tag: myTag
>>>
>>> but that does not work. What combination will actually work right?
>>>
>>>
>>>
>>> On Tue, Apr 12, 2016 at 9:42 AM, ac427 <[email protected]> wrote:
>>>
>>>> You can create group_vars directory 
>>>>
>>>> http://docs.ansible.com/ansible/intro_inventory.html#group-variables
>>>>
>>>>
>>>> On Tuesday, April 12, 2016 at 9:26:42 AM UTC-4, thanstra wrote:
>>>>>
>>>>> I currently have been putting both hosts and host related variables 
>>>>> into the /etc/ansible/hosts file with variables such as this:
>>>>>
>>>>> [myhosts]
>>>>> host1
>>>>> host2
>>>>>
>>>>> [host1]
>>>>> host1.domain
>>>>>
>>>>> [host1:vars]
>>>>> var1="Some data"
>>>>> var2="Some other data"
>>>>> tag1=myTag
>>>>>
>>>>> [host2]
>>>>> host2.domain
>>>>>
>>>>> [host2:vars]
>>>>> ...
>>>>>
>>>>> etc.  This all works but is not overly scalable as the number of 
>>>>> servers grows.
>>>>>
>>>>> How can I break this up into a more directory based structure so that 
>>>>> things can scale better with many servers. I've tried to read through 
>>>>> information on host_vars and group_vars but have not succeeded in getting 
>>>>> the syntax set up properly to mimic what I have working with the hosts 
>>>>> file.
>>>>>
>>>>> Can someone help me figure out directory structure, naming, and setup 
>>>>> to get that working?
>>>>>
>>>>> Thanks!
>>>>>
>>>> -- 
>>>> You received this message because you are subscribed to a topic in the 
>>>> Google Groups "Ansible Project" group.
>>>> To unsubscribe from this topic, visit 
>>>> https://groups.google.com/d/topic/ansible-project/N0uO3XRnAJE/unsubscribe
>>>> .
>>>> To unsubscribe from this group and all its topics, 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/82df3904-11a2-45ac-88d4-780967325f21%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/ansible-project/82df3904-11a2-45ac-88d4-780967325f21%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>> -- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "Ansible Project" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/ansible-project/N0uO3XRnAJE/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to 
>> [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/bceb8a68-b196-40e0-8c76-c188f291198c%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/bceb8a68-b196-40e0-8c76-c188f291198c%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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/461c89bd-05c5-49c0-8835-e1673b5f53ee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to