Skip to content

Commit

Permalink
Merge pull request #147 from chef/docs-cli-ref
Browse files Browse the repository at this point in the history
Start of CLI guide.
  • Loading branch information
mchiang0610 authored May 22, 2018
2 parents 7e67c8c + c0137d7 commit ebc3fd8
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 1 deletion.
2 changes: 1 addition & 1 deletion www/chef-www
87 changes: 87 additions & 0 deletions www/site/content/docs/chef-workstation/cli-reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
+++
title = "CLI Reference"
[menu]
[menu.docs]
parent = "Chef Workstation"

+++

Chef-run is a tool to execute ad-hoc tasks using Chef.

`chef-run <TARGET[S]> <RESOURCE> <RESOURCE_NAME> [PROPERTIES] [FLAGS]`

Runs a single <RESOURCE> on the specified <TARGET[S]>.
[PROPERTIES] should be specified as key=value.

For example:

```
chef-run web01 service nginx
chef-run web01,web02 service nginx action=restart
chef-run web[1:2] service nginx priority=20 action=stop
```

`chef-run <TARGET[S]> <RECIPE> [FLAGS]`

Runs a single recipe located at <RECIPE> on the specified <TARGET[S]>.

For example:

```
chef-run web01 path/to/cookbook/recipe.rb
chef-run web01,web02 path/to/cookbook
chef-run web0[1:2] cookbook_name
chef-run web01 cookbook_name::recipe_name
```

ARGUMENTS:

```
<TARGET[S]> The hosts or IPs to target. Can also be an SSH or WinRM URLs
in the form:
ssh://[USERNAME]@example.com[:PORT]
<RESOURCE> A Chef resource, such as 'user' or 'package'
<RESOURCE_NAME> The name, usually used to specify what 'thing' to set up with
the resource. For example, given resource 'user', 'name' would be
the name of the user you wanted to create.
<RECIPE> The recipe to converge. This can be provided as one of:
1. Full path to a recipe file
2. Cookbook name. First we check the working directory for this
cookbook, then we check in the chef repository path. If a
cookbook is found we run the default recipe.
3. This behaves similarly to 'cookbook name' above, but it also allows
you to specify which recipe to use from the cookbook.
```

FLAGS:

```
-c, --config PATH Location of config file. Defaults to /Users/mchiang/.chef-workstation/config.toml
--cookbook-repo-paths PATH Comma separated list of cookbook repository paths.
-h, --help Show help and usage for `chef-run`
-i, --identity-file PATH SSH identity file to use when connecting. Keys loaded into ssh-agent will also be used.
--[no-]install Install Chef client on the target host(s) if it is not installed.
This defaults to enabled - the installation will be performed
if there is no Chef client on the target(s).
--password <PASSWORD> Password to use for authentication to the target(s). The same
password will be used for all targets.
-s, --[no-]ssl Use SSL for WinRM. Current default: false
-s, --[no-]ssl-verify Verify peer certificate when using SSL for WinRM
Use --ssl-no-verify when using SSL for WinRM and
the remote host is using a self-signed certificate.
Current default: true
--[no-]sudo Whether to use root permissions on the target. Default: true
--sudo-command <COMMAND> Command to use for administrative/root access. Defaults to 'sudo'.
--sudo-options 'OPTIONS...' Options to use with the sudo command. If there are multiple flags,
quote them. For example: --sudo-options '-H -P -s'
--sudo-password <PASSWORD> Password to use with the sudo command. This must be provided if
password is required for sudo on the target(s). The same sudo password
will be used for all targets.
--user <USER> Username to use for authentication to the target(s). The same
username will be used for all targets.
-v, --version Show the current version of Chef Run.
```



0 comments on commit ebc3fd8

Please sign in to comment.