matschaffer / knife-solo

DEPRECATED: Please consider using https://knife-zero.github.io/, ansible, or visit https://www.chef.io/ for other ideas
MIT License
787 stars 213 forks source link

passing knife solo bootstrape the ssh usernmae and password still result with prompts for password #483

Open tal5ab opened 8 years ago

tal5ab commented 8 years ago

When i pass --ssh-user user --ssh-password Password to the knife solo bootstrape command The prepare part pass ok , but the cook part does not pick up the password Which make me enter the password 6-7 times:


C:\QAOps\test1>knife solo bootstrap host --ssh-user user --ssh-password pass -r install_em_v9 --ssh-control-master=no
Bootstrapping Chef...
Refreshing catalog 1/1 solaris
pkg install: The following pattern(s) did not match any allowable packages.  Try

using a different matching pattern, or refreshing publisher information:

        web/ca-bundle
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 20077  100 20077    0     0  14925      0  0:00:01  0:00:01 --:--:-- 22111
solaris2 5.11 sparc
Getting information for chef stable 12.5.1 for solaris2...
downloading https://omnitruck-direct.chef.io/stable/chef/metadata?v=12.5.1&p=sol
aris2&pv=5.11&m=sparc
  to file /tmp/install.sh.242/metadata.txt
trying wget...
url     https://opscode-omnibus-packages.s3.amazonaws.com/solaris2/5.11/sparc/ch
ef-12.5.1-1.sparc.solaris
md5     1312e58df5e2e2108e7593f4dc103c87
sha256  a8c8b94d31c56f5a2f9877ef60b02a06c3f2a40b7fbff42f57ffb05ab0f8a8c1
version 12.5.1
downloaded metadata file looks valid...
downloading https://opscode-omnibus-packages.s3.amazonaws.com/solaris2/5.11/spar
c/chef-12.5.1-1.sparc.solaris
  to file /tmp/install.sh.242/chef-12.5.1-1.sparc.solaris
trying wget...
Comparing checksum with sha256sum...
Installing chef 12.5.1
installing with pkgadd...
Thank you for installing Chef!

Installation of <chef> was successful.
Running Chef on host...
Uploading the kitchen...
Password:
Password:
Password:
Password:
Password:
WARNING: Local role_path 'roles' does not exist
WARNING: Local data_bag_path 'data_bags' does not exist
WARNING: Local environment_path 'environments' does not exist
Generating solo config...
Password:
Running Chef: sudo chef-solo -c ~/chef-solo/solo.rb -j ~/chef-solo/dna.json
Starting Chef Client, version 12.5.1
Compiling Cookbooks...
Converging 4 resources
Recipe: install_V9::install
  * cookbook_file[/export/home/user/xx.xml] action
create_if_missing
matschaffer commented 8 years ago

There's no way for knife solo to pass the password directly to rsync which is why you still get prompts. If you're provisioning many times I recommend setting up ssh keys.

On Tuesday, 5 April 2016, Tal Abramson notifications@github.com wrote:

When i pass --ssh-user user --ssh-password Password to the knife solo bootstrape command The prepare part pass ok , but the cook part does not pick up the password Which make me enter the password 6-7 times:

C:\QAOps\test1>knife solo bootstrap host --ssh-user user --ssh-password pass -r install_em_v9 --ssh-control-master=no Bootstrapping Chef... Refreshing catalog 1/1 solaris pkg install: The following pattern(s) did not match any allowable packages. Try

using a different matching pattern, or refreshing publisher information:

    web/ca-bundle

% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 20077 100 20077 0 0 14925 0 0:00:01 0:00:01 --:--:-- 22111 solaris2 5.11 sparc Getting information for chef stable 12.5.1 for solaris2... downloading https://omnitruck-direct.chef.io/stable/chef/metadata?v=12.5.1&p=sol aris2&pv=5.11&m=sparc https://omnitruck-direct.chef.io/stable/chef/metadata?v=12.5.1&p=solaris2&pv=5.11&m=sparc to file /tmp/install.sh.242/metadata.txt trying wget... url https://opscode-omnibus-packages.s3.amazonaws.com/solaris2/5.11/sparc/ch ef-12.5.1-1.sparc.solaris md5 https://opscode-omnibus-packages.s3.amazonaws.com/solaris2/5.11/sparc/chef-12.5.1-1.sparc.solarismd5 1312e58df5e2e2108e7593f4dc103c87 sha256 a8c8b94d31c56f5a2f9877ef60b02a06c3f2a40b7fbff42f57ffb05ab0f8a8c1 version 12.5.1 downloaded metadata file looks valid... downloading https://opscode-omnibus-packages.s3.amazonaws.com/solaris2/5.11/spar c/chef-12.5.1-1.sparc.solaris https://opscode-omnibus-packages.s3.amazonaws.com/solaris2/5.11/sparc/chef-12.5.1-1.sparc.solaris to file /tmp/install.sh.242/chef-12.5.1-1.sparc.solaris trying wget... Comparing checksum with sha256sum... Installing chef 12.5.1 installing with pkgadd... Thank you for installing Chef!

Installation of was successful. Running Chef on host... Uploading the kitchen... Password: Password: Password: Password: Password: WARNING: Local role_path 'roles' does not exist WARNING: Local data_bag_path 'data_bags' does not exist WARNING: Local environment_path 'environments' does not exist Generating solo config... Password: Running Chef: sudo chef-solo -c ~/chef-solo/solo.rb -j ~/chef-solo/dna.json Starting Chef Client, version 12.5.1 Compiling Cookbooks... Converging 4 resources Recipe: install_V9::install

  • cookbook_file[/export/home/user/xx.xml] action create_if_missing

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/matschaffer/knife-solo/issues/483

-Mat

matschaffer.com

tal5ab commented 8 years ago

Yes , i have ended up automating the ssh key exchange It will be nice if i won't have to do that

matschaffer commented 8 years ago

Sadly at present there's nothing I can do. At some point I'd like to eliminate rsync in favor of a scp-ing a single tarball.

This will introduce a tar dependency, but should allow functionality with no more than 2 password prompts.

-Mat

matschaffer.com

On Wed, Apr 6, 2016 at 7:59 PM, Tal Abramson notifications@github.com wrote:

Yes , i have ended up automating the ssh key exchange It will be nice if i won't have to do that

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/matschaffer/knife-solo/issues/483#issuecomment-206310312

florian-asche commented 8 years ago

You could add some code around chef. Use sshpass for the first login / scp the public key. Then chef can login thanks to the key.

matschaffer commented 8 years ago

That's an interesting thought.

I don't think I'd want to make it totally magic since some people might have security concerns, but adding something like --generate-ssh-keys to prepare sounds like a decent idea to me.

askz commented 5 years ago

Hi ! For those still struggling with this issue I wrote a little expect script here:

#!/usr/bin/expect -f

eval spawn [lrange $argv 1 end]
while {true} {
  expect "'s password:*"
  send [lindex $argv 0]
  send "\r"
}

./ssh-wrapper.exp $SSHPASS knife solo cook <host>