The knife upload subcommand is used to upload roles, cookbooks, environments, and data bags to the Chef server from the current working directory in the chef-repo. This subcommand is often used in conjunction with knife diff, which can be used to see exactly what changes will be uploaded, and then knife download, which does the opposite of knife upload.
Note
Review the list of common options available to this (and all) Knife subcommands and plugins.
This subcommand has the following options:
The following examples show how to use this Knife subcommand:
Upload the entire chef-repo
Browse to the top level of the chef-repo and enter:
$ knife upload
or from anywhere in the chef-repo, enter:
$ knife upload /
Upload the /cookbooks directory
Browse to the top level of the chef-repo and enter:
$ knife upload cookbooks
or from anywhere in the chef-repo, enter:
$ knife upload /cookbooks
Upload the /environments directory
Browse to the top level of the chef-repo and enter:
$ knife upload environments
or from anywhere in the chef-repo, enter:
$ knife upload /environments
Upload a single environment
Browse to the top level of the chef-repo and enter:
$ knife upload environments/production.json
or from the environments/ directory, enter:
$ knife upload production.json
Upload the /roles directory
Browse to the top level of the chef-repo and enter:
$ knife upload roles
or from anywhere in the chef-repo, enter:
$ knife upload /roles
Upload cookbooks and roles
Browse to the top level of the chef-repo and enter:
$ knife upload cookbooks/apache\* roles/webserver.json
Use output of knife deps to pass command to knife upload
$ knife upload `knife deps nodes/*.json`