Use LDAP.

I couldn't resist. :-P

In all seriousness, though, grep is still your friend. He's brought a
couple new friends to the table to help you with this problem; their
names are "sed" and "awk".

With the example below, this should give you what you want:

grep ^node site.pp | sed -e 's/^node //' | awk -F,
'{for(i=1;i<=NF;i++) {print $i}}'

HTH

--Paul

On Tue, Jan 6, 2009 at 8:09 AM, John Philips <johnphilip...@yahoo.com> wrote:
>
> Hi,
>
> Is there a way to export a list of all manually-defined nodes in a puppet 
> configuration?
>
> I need to use this list in a script.  Previously it was easy because I had 
> each node individually defined in nodes.pp ala
>
> node 'blah1.com' {
>    include stuff
> }
> node 'blah2.com' {
>    include stuff
> }
>
> I could just grep the file for the word 'node' and parse the output.  
> However, since many nodes have the same layout, I condensed the configuration 
> and now I don't know how to extract the node names.
>
> Current layout:
>
> node 'blah1.com', 'blah2.com',
>         <snip>
>         'blah48.com, 'blah172.com' {
>    include stuff
> }
>
> Is there a way to parse the node list with a puppet utility or a ruby script? 
>  The output I'd like returned is very simple - 1 hostname per line.
>
> P.S. Please don't tell me to use LDAP :-)
>
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to