Jinesh:

This looks promising. I'm sure I'll have more questions as I get deeper 
into this.

Thanks.


On Friday, October 21, 2016 at 5:04:43 AM UTC-4, Jinesh Choksi wrote:

> If in your inventory file you were targeting all possible nodes which 
> require configuring:
>
> Then in a playbook (run on each of those nodes):
>
> - You could use: set_fact (
> http://docs.ansible.com/ansible/set_fact_module.html) to register a fact 
> containing the current node's gw. I think you can use the Jinja2 ipaddr() 
> filter to get the gateway (
> http://docs.ansible.com/ansible/playbooks_filters_ipaddr.html). 
> Alternatively, use the command module and any cli method you are familiar 
> with to get the gw.
>
> - You could use: CSV File Lookup (
> http://docs.ansible.com/ansible/playbooks_lookups.html#the-csv-file-lookup) 
> to lookup the current node's gw (which was registered as a fact above) and 
> get the location name. Then use CSV File Lookup again to get the 
> configuration information from the location and then do you configuration.
>
> Does that help?
>
>
> On Thursday, 20 October 2016 21:47:43 UTC+1, aenagy wrote:
>>
>> Brian:
>>
>> After reading http://docs.ansible.com/ansible/intro_inventory.html I'm 
>> thinking that I will end up with huge inventory files (hundreds or even 
>> thousands of systems) that are difficult to maintain -- something I was 
>> hoping to avoid. My thought was that if I had a (CSV) file with default 
>> gateway addresses and associated location names and another (CSV) file with 
>> location names with configuration information (DNS server IP addresses, DNS 
>> suffix search order) that Ansible could iterate over both to make the 
>> necessary changes. This way I only need to worry about the 'all' inventory.
>>
>>
>>
>> On Thursday, October 20, 2016 at 12:54:26 AM UTC-4, Brian Coca wrote:
>>
>>> Many ways to do this, I recommend using different groups for each and 
>>> then assigning variables with the different configurations, use those 
>>> variables in the plays.
>>>
>>> To store this data 'externally from playbook' I would use 
>>> group/host_vars.
>>>
>>> As for inventory, it does not need to be files, via the dynamic scripts 
>>> you can use any source of data to generate the inventory for Ansible, check 
>>> the existing ones as they should cover most common cases.
>>>
>>> -- 
>>> ----------
>>> Brian Coca
>>>
>>

-- 
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/729adb04-c5ba-40ce-b656-706ec19c0483%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to