Question

I am trying to bootstrap my client (Windows machine) to the hosted chef server (from opscode).

  1. I have successfully installed knife in my client machine.

  2. I am in chef-repo in users/ folder and have started the execution.

  3. I am not able to bootstrap with the chef-server.

Basically, chef-repo>knife bootstrap ipaddress -x user -P password is not working for me.

I am getting an error:

ERROR: network error. No connection could be made as the target machine actively refused it.

In the example, people have used opscode as both username and password. So what I should be using it ideally?

And the ipaddress is the client IP address right? The machine from where I want to upload the cookbooks to the server?

Was it helpful?

Solution

Bootstrapping Chef on Windows systems requires an additional knife plugin, knife-windows This plugin uses WinRM to allow you to call native objects in Windows remotely.

The plugin adds a few subcommands, notably knife bootstrap windows winrm and knife bootstrap windows ssh, as well as custom bootstrap templates designed for Windows.

Once you have installed the knife-windows plugin, you should be able to bootstrap your Windows system using a command similar to:

knife bootstrap windows winrm ipaddress -x Administrator -P 'super_secret_password'

OTHER TIPS

First to answer your two questions:

  1. The -x username and -P password parameters are the credentials for the node you want to bootstrap. So if you had a Windows VM that you login to as Administrator/password, then you would pass -x Administrator -P password

  2. Yes, the ipaddress is the address of the node you want to bootstrap for management with chef.

But no, the ipaddress is not "The machine from where I want to upload the cookbooks to the server?" And this makes me think you have a misunderstanding...

  • You upload cookbooks to the server from your workstation.
  • You initialise your workstation using knife configure --initial.
  • You can then upload cookbooks using knife cookbook upload cookbook_name

Whereas...

  • You use knife bootstrap (on your workstation) to install chef-client on, and register as a node with the chef-server, remote machines that you want to manage as chef nodes.
  • You do not need to knife bootstrap your workstation.

Regarding bootstrapping a Windows node, if that's what you want to do, @Michael has you on the right track.

Using WinRM requires that Windows is listening for HTTPS requests (port 5986 ). Therefore WinRM must be started on the Windows machine. But to do so requires that the machine have a certificate installed as well otherwise https won't work. And as far as I know knife bootstrap with winrm will only use secure comms.

for example...

winrm quickconfig -transport:https

Message = Cannot create a WinRM listener on HTTPS because this machine does not have an appropriate certificate. To be used for SSL, a certificate must have a CN matching the hostname, be appropriate for Server Authentication, and not be expired, revoked, or self-signed.

So... install a propert certificate, ensure winrm has started listening etc.

Use this to see the status...

winrm enumerate winrm/config/listener

Run following commands on the Windows client node Powershell

 set-item wsman:\localhost\shell\maxmemorypershellmb 1024
 set-item wsman:\localhost\MaxTimeoutms 300000
 set-item wsman:\localhost\service\allowunencrypted $true
 set-item wsman:\localhost\service\auth\basic $true

And then run following command on chef workstation

knife bootstrap -o winrm "ip_address" -U "Administrator" -P "password" -N "window_node"

New updated command to bootstrap a windows node

knife bootstrap -o winrm IP-Address -N 'Node-Name' -U Domain-OR-Local-User -P 'Password'

Node-Name: It will be displayed in Chef Automate console

Please check if you can do a telnet from the workstation to the node you try to access.

This can be checked by typing telnet in a command prompt.

If telnet is not recognized as a command, then follow the steps:

  1. Right click on "My Computer" > Manage > features
  2. Click on "Add Features"
  3. Select "Telnet Client"
  4. Press Install button

It will take sometime to install.

Once it is installed, you can do the same telnet from your workstation's command prompt to the chef node

telnet <ip_address> 5985 //5985 is the port you want to do telnet.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top