Opscode Chef Server / Workstation force commands from server - amazon-ec2

Background : Chef Server Version 12 and a Windows workstation SDK 0.10 targeting windows nodes
I've created recipes and bootstrapped local windows servers into the Chef manager and applied recipes so the very basics are all working.
Question : when running the bootstrap commands for a hosted server (e.g azure / aws) I need the command to come from the Chef Server not the workstation.
I had hoped that the knife.rb with the Chef_server_url would force all commands to come from there.
WireShark shows the WinRM connections trying to come from my workstation.
Is there any setting I can implement that forces this in the knife.rb or elsewhere?
I had tried to add the following from searches but they've not been successful :
chef_zero.enabled false
local_mode false
Is this resolved through Chef Provisioning rather than Chef knife commands?
many thanks in advance for any assistance you can give.

"when running the bootstrap commands for a hosted server (e.g azure / aws) I need the command to come from the Chef Server not the workstation." is not correct. Knife commands that manipulate servers go directly from your workstation, and this is how it is supposed to work. The way the bootstrap functions is it starts the cloud machine using the relevant provider API, then connects to the new VM via SSH or WinRM and installs Chef, and then launches chef-client using a configuration file based on your knife settings (this is where chef_server_url comes in).

Related

Vagrant/Chef Windows Bootstrapping Issue

I'm fairly new to doing DevOps stuff in Windows so I think the issue here is a gap in my own knowledge that so far I've been unable to plug despite trawling the web for hours and hours.
I'm using Vagrant to spin up a VM then the Chef Client provisioner to actually provision that VM.
I've configured Vagrant to log in via WinRM using an Administrator account, which then installs and runs chef under that user.
One of the executables I'm installing with Chef installs it's own dependencies (Microsoft SQL Local Database) as the 'SYSTEM' user, and then the program as the Admin user. For some reason, the installation of the exe fails because it can't access the LocalDB server because it's installed as 'SYSTEM'.
In my Chef recipe there is a task to set up the chef client to run as a Windows scheduled task under the 'SYSTEM' user. Is there anyway to get Vagrant to provision the chef client, instruct it what role/recipes I want to use, but only run it under the 'system' user as a scheduled task?
Thanks for any help in advance.

Can a Chef Server have multiple workstations?

We have a predefined configuration of the infrastructure where the nodes have a particular runlist of recipes controlled using a central Chef server and workstation.
I want to implement a knife command to force a deploy recipe to be run on all the nodes. Is it possible just to run the knife -o recipe command from a new workstation and let the server sync all the recipes from the central workstation itself?
Yes, you can use multiple workstations, but not quite the way you describe. When you push a cookbook (or policy) it gets uploaded into the Chef Server. All client nodes only talk to your Chef Server, not the workstation. That includes cookbooks and run lists (unless overridden with -o as you noted). So you can run knife ssh somequery sudo chef-client from any workstation any have it function the same.

Configure TCP endpoint when vagrant up or reload

I'm using Vagrant to run an Ubuntu VM with Microsoft Azure provider, but I need to create an endpoint on this VM.
I've done it installing azure command-line tools with
npm install azure-cli -g
and after that
azure vm endpoint create {VM-Name} 80 8080
VM is running fine without problems. But I don't want to configure the endpoint manually anymore. I would like to create it when I run vagrant up. I don't want to use vagrant provision, because this shell instruction should not be executed in my VM, but in my physical machine.
There is no options such as verbose in vagrant, which would have permitted me to see what it really does with the Vagrantfile, and what I should do to implement a shell command like this one in it.
Ansver to initial question, do the following:
in vagrantfile add following string in azure provider section:
azure.tcp_endpoints = '80:8080'
hope this help.
answer to your question about verbose output:
you may run vagrant up --provider=azure --debug
for additional debug information.
if you need to run local scripts you may try to use vagrant-triggers plugin

Cannot access sinatra app on AWS Windows from remote machine

I have a simple sinatra app running on an AWS windows instance. Running the application from the localhost works fine (i.e. http://localhost:4567), but I am unable to run it remotely.
My AWS windows instance is available to me from remote as I am able to connect to it using RDP.
After reading some other similar issues, I have already applied the following:
My AWS security group is opened for port 4567 (I actually also opened it for any inbound connection just to see if that will solve the issue - it didn't)
I tried running: ruby my_sinatra_app.rb -o 0.0.0.0
I tried running: ruby my_sinatra_app.rb -e production
I tried adding to the application itself the following code: set :bind, '0.0.0.0'
I am still unable to run the application remotely. Any idea?
I was able to solve my issue, so for the sake of completeness I am publishing the answer.
This wasn't a Sinatra issue, but an AWS issue (maybe not really an issue, more like my misunderstanding). I was under the impression that updating the AWS security group for opening the 4567 port will do the trick.
However, it turns out that I needed also to open the port on the Windows Firewall on my Windows AWS instance. After opening the port on the Windows Firewall I was able to remotely connect to my Sinatra app.

Running Chef cookbooks on ExaData

I am trying to run a Chef Cookbook on an ExaData server and I'm running into issues. I was able to bootstrap my ExaData servers. However when I run chef-client on the target nodes, I get an error like this. Then I went back and did a verbose output of the error, and still don't have any idea of what the issue is. I am able to ping, traceroute, and nc to and from the ExaData server to the Chef Server. None of the files transfer from the cookbook, or none of the files download from the remote Zabbix repository. The Chef run completes the role, and recipes but nothing is installed. Is there something different about ExaData from regular RHEL distributions that would cause issues?
--EDIT - 2013-07-15--
From looking at a "successful" chef-client run on a regular RHEL 6.2 OS, where as ExaData runs RHEL 5.8, I saw fewer errors. There does seem to be a lot of libraries missing from ExaData in order to run chef-client. From what I have heard, and read in other posts, was that ExaData is a stripped version of RHEL 5.8, using only what is needed to run databases.
According to a comment on the Chef IRC Logs the 404 message is because the client is attempting to use a feature that your server version doesn't support.
If you add the setting enable_reporting false to your client.rb file it should disable the request to the /reports URL.

Resources