[chef] Re: Re: Re: Re: Re: Re: chef-metal AWS Profile


Chronological Thread 
  • From: Tom Duffield < >
  • To: " " < >
  • Subject: [chef] Re: Re: Re: Re: Re: Re: chef-metal AWS Profile
  • Date: Tue, 14 Oct 2014 10:11:02 -0700

Instead of using '~/.aws/config', try using the fully-qualified path (maybe '/Users/doug/.aws/config'?). I have come across programs that don't play well with '~"


On Tue, Oct 14, 2014 at 10:08 AM, Douglas Garstang < " target="_blank"> > wrote:
It's not my day. I have the same thing Justin.

simple.rb:
require 'chef_metal'

ENV['AWS_CONFIG_FILE'] = '~/.aws/config'

with_machine_options :bootstrap_options => {
  :flavor_id => 'm3.medium',
  :key_name => 'ec2-default',
  :groups => ['slice-default'],
  :image_id => 'ami-fa7dc492',
  :source_key_path => '/Users/doug/git/ops-secure/ec2_keypairs/test-ec2-default'
}

with_driver 'fog:AWS:test'
machine 'mario' do
  tag 'itsa_me'
  converge true
end



~/.aws/config:
[profile prod]
aws_access_key_id = xxx
aws_secret_access_key = xxx
region = us-east-1

[profile test]
aws_access_key_id = xxx
aws_secret_access_key = xxx
region = us-east-1


Running 'chef-client -z simple.rb' gets me:

Recipe: @recipe_files::/Users/doug/simple.rb
  * machine[mario] action converge[2014-10-14T10:07:23-07:00] INFO: Processing machine[mario] action converge (@recipe_files::/Users/doug/simple.rb line 14)

================================================================================
Error executing action `converge` on resource 'machine[mario]'
================================================================================


RuntimeError
------------
No AWS profile specified!  Are you missing something in the Chef config or ~/.aws/config?


On Tue, Oct 14, 2014 at 9:56 AM, Justin Dossey < " target="_blank"> > wrote:
In my ec2 recipe, I set
ENV['AWS_CONFIG_FILE'] = '/path/to/.aws/config'

prior to the

with_driver(...)

statement, and that's working for me. 

On Tue, Oct 14, 2014 at 9:53 AM, Douglas Garstang < " target="_blank"> > wrote:
John,

File is ~/.aws/config. That was a typo in my initial email.

Douglass-MacBook-Pro:~ doug$ cat ~/.aws/config
[profile prod]
aws_access_key_id = xxx
aws_secret_access_key = xxx
region = us-east-1

[test]
aws_access_key_id = xxx
aws_secret_access_key = xxx
region = us-east-1




On Tue, Oct 14, 2014 at 9:40 AM, John Keiser < " target="_blank"> > wrote:
Looking at your issue, I'm guessing the problem is that it's looking in ~/.aws/config and you have ~/.aws.config (at least from the mail, maybe it was a typo?).

Can you try putting the file at that location and let us know if it works?  Is ~/.aws.config a standard location we should be handling as well?

On Tue, Oct 14, 2014 at 9:35 AM, Douglas Garstang < " target="_blank"> > wrote:
No replies. Is chef-metal an active project? Has it been replaced by something else?

Doug


On Mon, Oct 13, 2014 at 4:47 PM, Douglas Garstang < " target="_blank"> > wrote:
Not sure if this the right place to ask a chef-metal question.

Can't seem to get the AWS profiles to work. I keep getting this:

RuntimeError
------------
No AWS profile specified!  Are you missing something in the Chef config or ~/.aws/config?



My ~/.aws.config contains this:

[profile prod]
aws_access_key_id = <key_id>
aws_secret_access_key = <key>
region = us-east-1

[profile test]
aws_access_key_id = <key_id>
aws_secret_access_key = <key>
region = us-east-1


The reason the profille names have 'profile' at the front is because this is required for the AWS CLI, and boto as well, which also use this file.

I've tried setting these:

export CHEF_DRIVER="fog:AWS:test:us-east-1"
export CHEF_DRIVER="fog:AWS:profile test:us-east-1"

export CHEF_DRIVER="fog:AWS:<aws account #>:us-east-1"
export CHEF_DRIVER="fog:AWS:<aws account #> test:us-east-1"

None of those work (although they are being picked up because I see the value in the back trace).

I've also tried putting variations of the following into the simple.rb file:

with_driver 'fog:AWS:test'
with_driver 'fog:AWS:profile test'

and so on. Doesn't work.

I also tried this:

with_driver 'fog:AWS:test'
machine 'mario' do
  tag 'itsa_me'
  converge true
end

Didn't work. I tried this:

machine 'mario' do
  tag 'itsa_me'
  driver 'fog:AWS:test'
  converge true
end

and many many permutations. Also didn't work.

I then tried to put the settings into my ~/.chef/knife.rb. That also didn't work. Basically, NOTHING has worked. I keep getting the error above. Where should I put this?

To make matters more confusing, the gem seems to have been installed to my home directory under .chefdk. I don't know why as I use the gem that came with the chef-dk and that normally puts gems in /opt/chefdk/embedded (except for the chef-metal ones and it's dependancies).

Also,
Douglass-MacBook-Pro:~ doug$ /opt/chefdk/embedded/bin/gem list | grep chef-metal
chef-metal (0.14.2)
chef-metal-fog (0.9)
chef-metal-vagrant (0.6)


Thanks,
Doug.









I've also tried using 'profile test' instead of test, since that's what boto requi



--
Regards,

Douglas Garstang
http://www.linkedin.com/in/garstang
Email: " target="_blank">
Cell: +1-805-340-5627




--
Regards,

Douglas Garstang
http://www.linkedin.com/in/garstang
Email: " target="_blank">
Cell: +1-805-340-5627



--
Justin Dossey
Practice Owner
New Context Services, Inc



--
Regards,

Douglas Garstang
http://www.linkedin.com/in/garstang
Email: " target="_blank">
Cell: +1-805-340-5627




Archive powered by MHonArc 2.6.16.

§