The actions provide the basic primitives for pallet. These actions can be composed in crate functions to implement your configuration and operational requirements.

See the API documentation for details. In these examples, the first session argument is assumed to be threaded, and is elided.

Direct Script Execution

Sometimes pallet's other actions will not suffice for what you would like to achieve, so the exec-script actions allow you to execute arbitrary script.

(exec-script* "ls some/path")
(exec-script (ls "some/path"))
(exec-checked-script "List some path" (ls "some/path"))

Simple File Management

Files can be managed using the file, symbolic-link, and fifo actions.

(file "some/path" :owner "user", :group "group", :mode "0644")
(symbolic-link "original/path" "link/path")
(fifo "some/path" :owner "user", :group "group", :mode "0644")

Simple Directory Management

Directories can be managed using the directory, and directories actions.

(directory "some/path" :owner "user", :path true)
(directories ["some/path" "other/path"] :owner "root")

File Contents

File contents can be manipulated with remote-file, remote-directory, rsync-directory and sed.

(remote-file "some/path" :content "Some content", :owner "user")
(remote-directory "some/path" :local-file "my.tar.gz")
(rsync-directory "local/path" "remote/path")

Note that remote-directory can unpack archives.

Packages

Packages can be controlled via package, packages, package-manager, package-source, add-rpm, and minimal-packages.

(package "some/path")
(packages :aptitiude ["git-core"] :yum ["git"])
(package-manager :update)
(package-source
 "Partner" :aptitude {:url "http://archive.canonical.com/" :scopes ["partner"]})
(minimal-packages)

Users and Groups

Users and groups can be created and removed with user and group.

(user "tomcat" :system true, :shell "/bin/false", :group "tomcat")
(group "tomcat")

Services

Init style services can be controlled with service, and init-script.

(service "tomcat" :action :restart)