This might be better done with a shell script that calls facter 

“Sometimes I think the surest sign that intelligent life exists elsewhere in 
the universe is that none of it has tried to contact us.” 
Bill Waterson (Calvin & Hobbes) 

----- Original Message -----
From: "Christian Reiß" <reiss.symgen...@gmail.com> 
To: puppet-users@googlegroups.com 
Sent: Wednesday, August 14, 2013 6:20:41 AM 
Subject: [Puppet Users] Puppet, Facter, looping through IPs 


Hello all, 

I am trying to set up ssh keys (sshkeys) for populate /etc/ssh/ssh_known_hosts. 
So far it works great, but I want to have aliases for all ips online on that 
host. 

Two problems: 

- The assumption is that the interface count and names are unknown. There can 
be one eth or many, none but a xapi device etc. There is, however, interfaces 
variable from facter, which holds all the interfaces. 

- I need to loop through the array and use the contents of that variable, ie: 

interfaces => eth0,eth1,lo,tun0 
ipaddress => 46.229.47.132 
ipaddress_eth0 => 46.229.47.132 
ipaddress_eth1 => 10.1.0.2 
ipaddress_lo => 127.0.0.1 
ipaddress_tun0 => 10.10.0.1 

So I would need to loop through interfaces, query the variable with the same 
name to get the ip address. All this by acoiding loopback. 

- I dont know a good way to then add all compiled aliases into sshkeys. 

Does anyone have a pointer / solution? 

Thank you for your help in advance, 
Chris. 


-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group. 
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com. 
To post to this group, send email to puppet-users@googlegroups.com. 
Visit this group at http://groups.google.com/group/puppet-users . 
For more options, visit https://groups.google.com/groups/opt_out . 


-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to