Copy files from file resource to target folder


Greetings professionals

Can any one please help me how share a directory from cookbook_file resource to target windows server exact path

I am trying to install Appdymanics machine agent windows version , there is no setup.exe file available we need to copy the entire directory to remote server to target path and run the VB script which installs appd agent.

i have copied the appd directory to my cookbook_file directory and trying to push that to target path which is C:\Program Files (x86) but unable to do it , when ever i tried to bootstrap the windows node i could able to see cookbook_file under path C:\chef\cache\cookbooks\appd-windows

I tried using windows commands in the recipe to move folder from default path to target path but it fails
below is the recipe im using

windows_package ‘appdynamics’ do
source 'file:///C:/chef/cache/cookbooks/appd-windows
action :nothing

execute ‘appd-windows’ do
command ’ C:\chef\cache\cookbooks\appd-windows>move C:\Program Files (x86)’ #/E’

Please help…!



Good morning Prash,

Here is the logic I use to install and configure the AppDynamics agent.

Create AppD template file

cookbook_file “#{node[‘serverInfo’][‘tools_dir’]}/appd_template.xml” do
source "_appd_template.xml"
action :create

cookbook_file “#{node[‘serverInfo’][‘tools_dir’]}\dotNetAgentSetup.msi” do
source 'dotNetAgentSetup.msi’
action :create

Install AppDynamics Agent

windows_package ‘appdynamics’ do
action :install
source “#{node[‘serverInfo’][‘tools_dir’]}\dotNetAgentSetup.msi"
options “/q /norestart /lv “#{node[‘serverInfo’][‘tools_dir’]}\AgentInstaller.log” AD_SetupFile=”#{node[‘serverInfo’][‘tools_dir’]}\appd_template.xml”"

the node[‘serverInfo’][‘tools_dir’] is an attribute I define that points to a local path on a server where we keep installer files and various tools for administrative use.

So basically I store the current AppD installer file and various AppD template files in my cookbook, I copy both down to the server and then use the windows_package resource to install and configure it.



Just as a side note: Cookbooks are not supposed to be file storages and the Chef Server is not optimized to server large binary files. You will run into massive troubles quite soon if you really store MSI or any other large files in your cookbooks.
You should use Artifactory or similar for that or at least keep the files on a File share.