Comments (11)
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.
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.
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.
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.
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.
@jkeiser Any updates on this? Thanks.
from chef-provisioning.
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.
can you show me your code and how you run it? Maybe I'm just doing it wrong?
from chef-provisioning.
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.
@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.
Awesome! Glad it's working :)
from chef-provisioning.
Related Issues (20)
- LoadError: cannot load such file -- chef/provisioning
- machine_file fails with NoMethodError: undefined method `[]' for nil:NilClass
- How to run multiple chef-client processes in parallel HOT 1
- setting up chef_version doesn't seems to be working HOT 2
- 401 error on node \ client precreation HOT 1
- driver template HOT 1
- with_machine_options() being ignored 100% with machine_batch
- with_machine_options() being ignored 100% with machine_batch HOT 1
- Where does specs_and_options get defined at?
- "Cannot forward a socketless Chef Zero server" error when following Vagrant try it out HOT 1
- machine_batch resource fails with chef 13 HOT 2
- winrm available? function exception when using SSL
- [Q] Can this autoprovision BMC ports and PXE NIC on the server?
- Chef-client -z -j xyz.json /var/chef/cache/cookbooks/xyz/recipes/default.rb
- Feature request: KVM drivers
- undefined method `[]' for nil:NilClass () HOT 2
- Error: Unsupported reporting protocol version - While querying chef reporting api HOT 1
- Allow use of net-ssh 5.2.0 gem HOT 1
- chef-provisisioning does not work with new license acceptance framework HOT 1
- Dependabot can't parse your Gemfile
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chef-provisioning.