Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

RSS

remote-exec (3) Versions 0.2.0

remote_execute resource for Chef

Policyfile
Berkshelf
Knife
cookbook 'remote-exec', '~> 0.2.0', :supermarket
cookbook 'remote-exec', '~> 0.2.0'
knife supermarket install remote-exec
knife supermarket download remote-exec
README
Dependencies
Quality 17%

remote-exec cookbook

This cookbook implements remote_execute resource. As its name implies, the resource
executes a command on a remote server using ssh.

Requirements

Tested only with Chef 12. The cookbook uses Net:SSH Ruby module, which is expected
to be installed. I think, it is usually the case, if you have chef-client.

Resources

remote_execute 'i wanna do something' do
  command 'ls -l'
  address '127.0.0.1'
  user 'root'
  password 'dontknow'
end

Syntax:

remote_execute 'name' do
  address   String          #
  command   String          # defaults to name
  returns   Integer, Array  #
  password  String          #
  user      String          #
  timeout   Integer         # default: 60
  input     String          #

  not_if_remote   String    #
  only_if_remote  String    #

  action    Symbol          # defaults to :run
end

Actions

The resource has the following actions:

:nothing
Prevent a command from running. Does nothing ;-)

:run
Default. Run a command.

Properties

The resource has the following properties:

command
The name of the command to be executed. Default value: the name of the resource block

returns
The return value for a command. This may be an array of accepted values. An exception is raised when the return value(s) do not match. Default value: 0.

address
The address of the remote server.

user
The username used to connect to the remote server.

password
The password for the user to connect to the remote server. If not specified, Net:SSH tries to connect using SSH keys, and if it doesn't help, asks for a password.

timeout
Timeout for SSH session. Default is 60 seconds.

input
The string will be sent as stdin to the command.

Guards

There are 2 additional guards, implemented in the resource:

not_if_remote
It prevents a resource from executing, if the specified condition (command) returns on the remote server true (0).

only_if_remote
It allows a resource to execute, only if the specified condition (command) returns on the remote server true (0).

Example

remote_execute 'create a file' do
  command 'touch /tmp/tempfile'
  address '192.168.0.1'
  user 'root'
  password 'dontknow'
  only_if_remote 'ls /dev/null'
end

ChangeLog

v0.2.0 2017-02-18

  • input option added

v0.1.1 2016-11-28

  • timeout option added

v0.1.0 2016-11-07

  • Initial release

Dependent cookbooks

This cookbook has no specified dependencies.

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

Collaborator Number Metric
            

0.2.0 failed this metric

Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Contributing File Metric
            

0.2.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file

Foodcritic Metric
            

0.2.0 failed this metric

FC066: Ensure chef_version is set in metadata: remote-exec/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: remote-exec/metadata.rb:1
FC069: Ensure standardized license defined in metadata: remote-exec/metadata.rb:1
FC115: Custom resource contains a name_property that is required: remote-exec/resources/remote_execute.rb:22
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any

No Binaries Metric
            

0.2.0 passed this metric

Testing File Metric
            

0.2.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file

Version Tag Metric
            

0.2.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number