[chef] Re: Re: Re: Re: Re: RE: Ohai Plugin Running External Commands


Chronological Thread 
  • From: Douglas Garstang < >
  • To:
  • Subject: [chef] Re: Re: Re: Re: Re: RE: Ohai Plugin Running External Commands
  • Date: Wed, 3 Dec 2014 11:59:43 -0800

Don't suppose you know if fog lets you perform AWS operations without an access key/secret access key when the instance belongs to an IAM profile? Can't find specific docs on this, and when I leave them out (which I can do with python boto), it just complains they are missing.

I'm also installing fog with "gem install fog –no-ri –no-rdoc" and have been waiting about 20 minutes for for "Parsing documentation for fog-1.25.0" to complete on an m3.large EC2 instance. :(

Doug.

On Wed, Dec 3, 2014 at 11:24 AM, Daniel Condomitti < " target="_blank"> > wrote:
I would recommend using the API directly instead of shelling out to aws-cli just to parse it back into a machine readable format. Fog[0] is a good place to start and supports multiple cloud providers if you end up going down that route. I don’t know for sure that it allows searching by instance tag (over listing all instances and filtering) but I would expect that it does.

Dan

On Wednesday, December 3, 2014 at 1:36 PM, Douglas Garstang wrote:

Dennis,

Of course. It's just translating that into something that ohai runs and returns as a dictionary that's tricky. The plugin also has to run the aws cli to get it's environment and role and feed that back into the describe-instances to get a list of matching instances. It seems like a rather clunky approach. I certainly don't want to run chef search due to the whole having-to-have-already run thing, which means the chef client has to then get run multiple times. Not scalable.

Douglas.

On Wed, Dec 3, 2014 at 10:31 AM, Dennis Lovely < " target="_blank"> > wrote:
You can search with AWS CLI:

ec2-describe-instances --filter "tag:YourTagName=YourRequestedValue"

Is this what you're looking for?

hth


-Dennis


On Wed, Dec 3, 2014 at 10:20 AM, Douglas Garstang < " target="_blank"> > wrote:
Thanks.

I was actually trying to get a list of ec2 instances having tags with specific values. I don't want to use chef search due to the requirement that all the nodes must have successfully completed a chef run first.

Douglas.

On Wed, Dec 3, 2014 at 8:45 AM, Jeremy Mauro < " target="_blank"> > wrote:

Here is one of our ohai :

lspci = Mixlib::ShellOut.new(

    'lspci -m',

<%  if node['platform_family'] == 'windows' -%>

    :cwd => "<%= node[:pciutils][:path] %>",

<% end -%>

  )

  lspci.run_command

  stdout, stderr = [lspci.stdout, lspci.stderr]

 

 

 

 

 

From: Douglas Garstang [mailto: " target="_blank"> ]
Sent: mercredi 3 décembre 2014 17:28
To: " target="_blank">
Subject: [chef] Ohai Plugin Running External Commands

 

Has anyone got any examples of custom ohai plugins calling external shell commands in ruby and returning the result? Having trouble with it. Need to pull some EC2 tags into chef (via AWS CLI) and an ohai plugin seemed like the right idea.

Doug




--




--




--



Archive powered by MHonArc 2.6.16.

§