Extracting the nodes in an environment that contain a particular cookbook

Hello,

I’m hoping that someone could assist me.

I’ve got a situation in that I’m trying to find the nodes in an environment that contain a particular cookbook in it’s run list.

How would I do this without using knife? I’m going to put it into a recipe.

Many thanks

Sent from iCloud

I can't provide specifics but this will surely do it:

I don't know if there's an efficient way of searching for a specific
cookbook across the run lists of all nodes, as I've never played with
Chef's REST API, but there's probably a way. It's all a bit beyond what
you'd normally do within a Chef cookbook, though, at least in my opinion.
What are you trying to accomplish in the end?

On Tue, Sep 15, 2015 at 2:05 PM, ANGELA EBIRIM aebirim@icloud.com wrote:

Hello,

I'm hoping that someone could assist me.

I've got a situation in that I'm trying to find the nodes in an
environment that contain a particular cookbook in it's run list.

How would I do this without using knife? I'm going to put it into a recipe.

Many thanks

Sent from iCloud

Hi Fabien,

Thanks for all the useful responses!

I’m implementing a standalone logstash that will receive http logs from another logstash install, in the same environment, over tcp.

So from logstash A, the output config will be
output
{
tcp {
port : 9090
host:
}
}

and on logstash B, the input config will be
input
{
port: 9090
host:
}
}

so the need is to find a way to programmatically deduce the ip addresses of the various nodes on which the logstash installs rest because our aws environments (dev) shut down each night and so the ip addresses will be different each time a new instance comes up.

Sent from iCloud

On Sep 15, 2015, at 11:22 AM, Fabien Delpierre fabien.delpierre@gmail.com wrote:

I can’t provide specifics but this will surely do it:
https://docs.chef.io/api_chef_server.html#nodes
https://docs.chef.io/api_chef_server.html#search
I don’t know if there’s an efficient way of searching for a specific cookbook across the run lists of all nodes, as I’ve never played with Chef’s REST API, but there’s probably a way. It’s all a bit beyond what you’d normally do within a Chef cookbook, though, at least in my opinion. What are you trying to accomplish in the end?

On Tue, Sep 15, 2015 at 2:05 PM, ANGELA EBIRIM aebirim@icloud.com wrote:
Hello,

I’m hoping that someone could assist me.

I’ve got a situation in that I’m trying to find the nodes in an environment that contain a particular cookbook in it’s run list.

How would I do this without using knife? I’m going to put it into a recipe.

Many thanks

Sent from iCloud

Since you're using AWS, it might be easier to query the AWS API for those
IP addresses and insert them into your Logstash config files using Chef
templates. You'd just have to assign an IAM role to your EC2 instances that
is allowed to query the API for that stuff.

On Tue, Sep 15, 2015 at 3:24 PM, ANGELA EBIRIM aebirim@icloud.com wrote:

Hi Fabien,

Thanks for all the useful responses!

I'm implementing a standalone logstash that will receive http logs from
another logstash install, in the same environment, over tcp.

So from logstash A, the output config will be
output
{
tcp {
port : 9090
host:
}
}

and on logstash B, the input config will be
input
{
port: 9090
host:
}
}

so the need is to find a way to programmatically deduce the ip addresses
of the various nodes on which the logstash installs rest because our aws
environments (dev) shut down each night and so the ip addresses will be
different each time a new instance comes up.

Sent from iCloud

On Sep 15, 2015, at 11:22 AM, Fabien Delpierre fabien.delpierre@gmail.com
wrote:

I can't provide specifics but this will surely do it:
Chef Infra Server API
Chef Infra Server API
I don't know if there's an efficient way of searching for a specific
cookbook across the run lists of all nodes, as I've never played with
Chef's REST API, but there's probably a way. It's all a bit beyond what
you'd normally do within a Chef cookbook, though, at least in my opinion.
What are you trying to accomplish in the end?

On Tue, Sep 15, 2015 at 2:05 PM, ANGELA EBIRIM aebirim@icloud.com wrote:

Hello,

I'm hoping that someone could assist me.

I've got a situation in that I'm trying to find the nodes in an
environment that contain a particular cookbook in it's run list.

How would I do this without using knife? I'm going to put it into a
recipe.

Many thanks

Sent from iCloud

search(:node, 'recipes:foo AND chef_environment: bar)
On Sep 15, 2015 11:05 AM, "ANGELA EBIRIM" aebirim@icloud.com wrote:

Hello,

I'm hoping that someone could assist me.

I've got a situation in that I'm trying to find the nodes in an
environment that contain a particular cookbook in it's run list.

How would I do this without using knife? I'm going to put it into a recipe.

Many thanks

Sent from iCloud