Dick what I meant by "it will be a bit too much" is that I have over 100 
hosts, and it will only increase. Do I really want to create a file for 
each of these hosts in the host_vars directory? 
This does not seem like it will scale well. 1000 hosts means 1000 files in 
host_vars directory. 

Considering I have over 100 hosts, each with it's own host-specific 
variables/values. And I need to use these variables/values in my jinja 
template to render a config for each host. 
You being the expert here, how do you think I should approach this? 
 - Create yaml files for each of the 100 hosts in /etc/ansible/host_vars. ( 
host_vars/host1, host2 ...host100)
 - Inside of my hosts file in /etc/ansible/hosts.yaml/ini, for each host in 
hosts, define variables/values for each host (I could use the hosts.ini too)
 - or you're thinking of something else? Or one the two above will work 
some tweaking? 

Thanks for the support. My head hurts now. 

On Wednesday, April 29, 2020 at 12:54:32 AM UTC-7, Dick Visser wrote:
>
> On Tue, 28 Apr 2020 at 23:30, Momodou Fatty <[email protected] 
> <javascript:>> wrote: 
> > 
> > That's a nice suggestion and I agree it will solve the problem to an 
> extent. 
> > I only showed a simple interface config here to keep things simple but 
> the host specific configs is much more than just the mgmt em0 ip address. 
> Let me give you a more realistic example: 
> > 
> > 10.10.10.10: 
> >   hostname: hostname1 
> >   data_nexthop: 100.12.1.7 
> >   interfaces: 
> >     mgmt_interface: 
> >       name: em0 
> >       ip: 10.10.10.10 
> >       subnet: 31 
> >     data_interface: 
> >       name:  et-0/0/3 
> >       ip: 100.12.1.6 
> >       subnet: 31 
> >       tor_name: seattle_router_01 
> > 
> > 
> > See the data_interface is going to be different for each host, the 
> data_interface's ip, next_hop and it's tor_name are all specific to each 
> host. 
> > 
> > Would you recommend I put all of these host_specific values in host file 
> then? I mean the /etc/ansible/hosts? 
> > 
> > Creating a yaml file for each host under  /etc/ansible/host_vars will be 
> a bit too much. 
>
> What do you mean by "it will be a bit too much"? 
> I'm not sure what problem is? 
>
> As I said before, the host_vars directory is meant to house (at least) 
> one file per host. 
> That piece of YAML you posted is NOT going to work inside host_vars 
> (but see below). 
>
> The other way to define per-host variables is the inventory. 
> What you have now already is almost exactly what a (YAML based) 
> inventory file looks like. 
> That can be a single file, so if that is what you are after (I'm 
> deducting this from your statement about one file per host being "a 
> bit too much" - but correct me if I'm wrong), then problem solved. 
>
> No matter how you look at it, you have a large number of hosts, each 
> having an inherently complex (i.e. nested) set of specific host 
> variables. 
>
>
> -- 
> Dick Visser 
> Trust & Identity Service Operations Manager 
> GÉANT 
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5e8204c6-2a85-4eac-a0b7-f9dddf6c73d8%40googlegroups.com.

Reply via email to