Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

knife bootstrap command without prompting password

I am trying to write a bash script which contains the command for bootstrapping a Ubuntu client node using knife command. When I execute the script, the knife command was asking the sudo password of client node and once i type the password, it works as expected. But I am looking for an automated way without prompting password. Here is the command I used for bootstrapping.

knife bootstrap <IP_ADDRESS> -x <USER_NAME> -P <PASSWORD> --sudo 

After checking, knife bootstrap document, I have tried giving the ssh-password also like below, but with same result.

knife bootstrap <IP_ADDRESS> --ssh-user <USER_NAME> --ssh-password <PASSWORD> --sudo

What may be wrong with this command. I am expecting the knife command to automatically login to the client and bootstrap, but its asking like,

<IP_ADDRESS> knife sudo password:
 Enter your password:

Any ideas??

like image 785
HRM Avatar asked Aug 26 '13 01:08

HRM


2 Answers

Looking through the doc this may be the parameter you need:

--use-sudo-password

Although the documentation seems to imply that the password that that will be used is the same for the ssh operation, I don't know if that will be sufficient in your case.

Reference: https://docs.chef.io/knife_bootstrap.html#knife-bootstrap-options

like image 182
DavidC Avatar answered Oct 08 '22 23:10

DavidC


If you want to avoid using passwords , you could set up the ssh keys of your workstation on the chef-node and run the

knife bootstrap yourclient.domain.com -x <USER_NAME> -i ~/.ssh/id_rsa -N client1 --sudo
like image 32
Balualways Avatar answered Oct 08 '22 22:10

Balualways