R Tyler Croy 97ae0d52a6 | ||
---|---|---|
cli | ||
.gitignore | ||
Cargo.lock | ||
Cargo.toml | ||
README.adoc | ||
inventory.yml |
README.adoc
<html lang="en">
<head>
</head>
</html>
Zap
A simple cross-platform orchestration and configuration management tool.
The main goal for Zap is to a simple mechanism for managing groups of computers with varying configurations and needs. Zap accomplishes this with "tasks" which can be composed into "plans" or run standalone. These tasks can be collections of scripts or a statically linked binaries, which will be pushed to the target machine(s) and executed.
Zap borrows ideas from Puppet Bolt. but leaves some of the Puppet-based legacy from Bolt behind.
Goals
-
Support BSD and Linux with ease
-
Make creating a plan very easy, including adding some simple logic
-
Explore tags-based task assignment
-
Pulll dependencies in through git-subtree or other, no inventing a new package distribution mechanism
Sketches
install.ztask
/*
* The FileSync should be an internal task type
*/
task FileSync {
parameters {
localfile {
type = string
help = "Path on the local system for the file to sync"
required = true
}
remotefile {
type = "string"
help = "Path on the remote system for the file"
required = true
}
}
}
// Sketch of a user-defined task
task Install {
// The restrict block is a collection of expressions which ensure that the
// task is not run anywhere it cannot run. Will fail if it's tried to run
// somewhere it cannot be run
restrict {
// Regular expression to define what
match_fact("platform", "(.*)-freebsd")
match_fact("hostname", "www1")
}
parameters {
package {
type = string
help = 'The package to be installed'
required = true
}
unless {
type = string
help = "Script which when returns zero if the package has been installed, i.e. `test -f /usr/bin/nginx`"
}
}
// Parameters exposed as environment variables
// including the "ZAP_NOOP" variable which will be set if the script should
// be run in noop
script {
// either the file or the inline must be defined
file = "path/to/file/in/tree"
// When using `program`, the task should expect to find:
// command-name_x86_64-unknown-linux-gnu
program = "/path/to/exes/in/tree"
inline = """
"""
}
}
/ Exploring module syntax for namespacing these */
module Install {
task Pkg {
restrict {}
parameters {}
script {}
}
task Zypper {
restrict {}
parameters {}
script {}
}
}
Sketch of a zplan
// Should things be just done proceduraly?
task("sync-tree.ztask") { }
task('tasks/install.ztask') {
name = "install-nginx"
package = "nginx"
unless = "test -f /usr/bin/nginx"
}
// Run another plan from within this plan (supdawg)
plan("plans/prepare-website.zplan") {
// What parameters make sense here?
}
// Relationships between tasks, option A
task('tasks/sync-tree.zplan') {
source = './foo'
destination = '/'
then = ["install-nginx"]
}
// Relationships between tasks, option B
task('tasks/sync-tree.zplan') {
source = './foo'
destination = '/'
then {
task("tasks/install.ztask") {
package = "nginx"
unless = "test -f /usr/bin/nginx"
}
}
}