[Puppet Users] Re: Searching for Nodes

Brian Malinconico
Fri, 25 Jan 2013 13:45:43 -0000

Thank you all for your feedback.

For anyone looking to do the same here is what i ended up with, I would
appreciate any recommendations if there is a better way to do this, I find
it dirty and think it should be done in the ''view'' layer :)

==== Class for node that is providing the IP address

class primarydatabase  {
  include concat::setup

  @@concat::fragment {''databaseIP'' :
    content => $::ipaddress,
  }
}


==== Class for node that needs the IP address

class base {
  include concat::setup

  package { ''htop'':
    ensure => installed,
  }

   $db_file = "/root/database.yml"

   concat{$db_file:
      owner => root,
      group => root,
      mode  => ''0644'',
   }

   concat::fragment { "${db_file}.header":
      target => $db_file,
      content => "# Managed By Puppet\n\n",
      order   => ''01'',
   }

  concat::fragment {"${db_file}_production_database_config" :
    target => $db_file,
    content => "production:\n  host: ",
    order => 100,
  }

  Concat::Fragment <<| title == ''databaseIP'' |>> {
    target => $db_file,
    order => 101,
  }
}






On Thursday, January 24, 2013 10:55:33 AM UTC-5, Brian Malinconico
wrote:
>
> Hello All,
>
> I''m reviewing switching to puppet from chef and am trying to
identify how
> to port the various features.
>
> I have hit a stumbling block searching for nodes. In Chef i could search
> for a node by role, but I am lost as how to do this with puppet and
classes.
>
> Example:
> I want my load-balancing node  to look for all application server nodes
> and grab their ip address (and hostname ideally).
>
> I have setup PuppetDB, and have looked at
> http://forge.puppetlabs.com/dalen/puppetdbquery but i am having trouble
> crafting my queries.
>
> Is there a way to view all available fields in PuppetDB? I am having
> trouble getting the curl commands to work.
>
> Brian
>

--
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+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.