GithubHelp home page GithubHelp logo

Comments (11)

jkeiser avatar jkeiser commented on May 28, 2024

I believe ssh_username has to be separate (just based on the docs, I haven't had a moment to take it for a spin):

machine 'Machine' do
    run_list ["recipe[tomcat]"]
    machine_options :ssh_username => 'ec2-user',
          :bootstrap_options => {
            :image_id =>'ami-ed8e9284',
            :flavor_id => 'm3.medium',
            :availability_zone =>'us-east-1b',
            :key_name =>'cls-master-dev',
            :private_key_path => 'something.pem',
            :groups => 'group'}
end

from chef-provisioning.

mikesplain avatar mikesplain commented on May 28, 2024

I was able to get ssh_username working for Openstack in an older version of the driver like this:

with_fog_provisioner :provider => 'OpenStack',
    :openstack_api_key => '*******',
    :openstack_username => '*******',
    :openstack_auth_url => '******************************',
    :openstack_tenant => '********************',
    :base_bootstrap_options => {
      :flavor_ref => 8,
      :image_ref => 'de556903-0bc5-4708-890d-5f9ddc0f50e2', #ubuntu
      # :image_ref => '83869269-48a9-485d-8046-db24f90b6b55', #centos
      :security_groups => 'default'
    },
    :ssh_username => 'stack'

But I don't think I had it working inside with_provisioner_options, which point towards @jkeiser's point above. Also note, it did throw a warn saying it didn't know what ssh_username was, but then fog took it and executed properly. I haven't had time to switch to the new beta for this setup yet, but may in the next day or so. Good luck!

from chef-provisioning.

hntd187 avatar hntd187 commented on May 28, 2024

Neither option seemed to work... @jkeiser what docs are you referring to?

require 'chef/config'
require 'chef_metal_fog'
require 'chef_metal'
require 'cheffish'

with_driver "fog:AWS:default"

with_chef_server "https://fakeserver.com", {
    :node_name      => "user",
    :client_name        => "user",
    :client_key         => Chef::Config[:client_key],
    :validation_key     => Chef::Config[:validation_key],
    :validation_client_name => Chef::Config[:validation_client_name],
    :signing_key_filename   => Chef::Config[:client_key]
}

machine 'Machine' do
    run_list ["recipe[tomcat]"]
    machine_options :ssh_username => 'ec2-user',
            :bootstrap_options => {
            :image_id =>'ami-ed8e9284',
            :flavor_id => 'm3.medium',
            :availability_zone =>'us-east-1b',
            :key_name =>'cls-master-dev',
            :private_key_path => 'something.pem',
            :groups => 'group'}
end

from chef-provisioning.

hntd187 avatar hntd187 commented on May 28, 2024

In addition, basically any modern AMI ids don't work. Not sure if this is a fog issue, but going to the AWS console and taking even an Ubuntu image or a amazon linux image tells me hthe ami doesn't exist.

from chef-provisioning.

jkeiser avatar jkeiser commented on May 28, 2024

Modern AMI ids not working sounds a lot like what happens you're connected to the wrong account ... I would give 0.11.beta.7 a try--it has massive improvements in account selection--and then if that's still not working, find out what account it's connected to (a 12 digit ID) and see if it's the same as the one on your account.

I will see if I can repro the ssh_username as soon as I get a moment.

from chef-provisioning.

hntd187 avatar hntd187 commented on May 28, 2024

@jkeiser Any updates on this? Thanks.

from chef-provisioning.

jkeiser avatar jkeiser commented on May 28, 2024

I don't repro the ssh_username issue--it works for me. Is the latest version working for you? 0.11 is released.

from chef-provisioning.

hntd187 avatar hntd187 commented on May 28, 2024

can you show me your code and how you run it? Maybe I'm just doing it wrong?

from chef-provisioning.

jkeiser avatar jkeiser commented on May 28, 2024

This isn't the BEST way to run the code, but it's the simplest. Check out the latest chef-metal source, cd into . Replace the with_driver with your own driver URL, and run this recipe:

require 'chef_metal'
# Makes the stuff below run serial instead of parallel for demonstration purposes
auto_batch_machines false

# Replace this with your driver
with_driver 'fog:AWS'

with_machine_options :ssh_username => 'ubuntu'
machine 'shouldsucceed'

with_machine_options :ssh_username => 'blarghle'
machine 'shouldfail'

Then, I run:

chef-metal/docs/examples $ chef-client -z therecipe.rb

Make sure you are running chef-metal 0.11.1 (not beta) so that we're running the same stuff. And chef-metal-fog 0.5.1.

If you want to see exactly what is going on, add chef-client -l debug. I see this at the point of failure:

    - waiting for shouldfail (i-ecb77bbe on fog:AWS:862552916454:us-east-1) to be connectable (transport up and running) ...[2014-06-04T14:06:48-07:00] INFO: Executing sudo pwd on [email protected]
[2014-06-04T14:06:48-07:00] DEBUG: Opening SSH connection to [email protected] with options {:timeout=>10, :auth_methods=>["publickey"], :keys_only=>true, :host_key_alias=>"i-ecb77bbe.AWS", :key_data=>["-----BEGIN RSA PRIVATE KEY----...-----END RSA PRIVATE KEY-----"]}
[2014-06-04T14:06:49-07:00] DEBUG: [email protected] unavailable: SSH authentication error: #<Net::SSH::AuthenticationFailed: Authentication failed for user [email protected]>

Mind you, this doesn't tell me whether the issue is the key I created or the username being wrong. But the fact that the other one succeeds tells me the username is in fact being honored (and switched).

from chef-provisioning.

hntd187 avatar hntd187 commented on May 28, 2024

@jkeiser That is working for me as well now, I had the options in the bootstrap options, which apparently was why it wasn't being passed in correctly. All works correctly now, thanks!

from chef-provisioning.

jkeiser avatar jkeiser commented on May 28, 2024

Awesome! Glad it's working :)

from chef-provisioning.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.