Commit Graph

47 Commits

Author SHA1 Message Date
R Tyler Croy eac957569c Upgrade dependencies 2021-05-23 11:50:50 -07:00
R Tyler Croy e3717a4cef Revert "Checking in an abandoned work in progress on task URI management"
This reverts commit 403de15964.
2021-01-31 15:02:00 -08:00
R Tyler Croy 403de15964 Checking in an abandoned work in progress on task URI management 2021-01-31 15:01:42 -08:00
R Tyler Croy 443b7f878d Document built-in step
Only one at the moment
2021-01-01 20:44:22 -08:00
R Tyler Croy 35e186f828 Explore syntax for built-in tasks. Implementation is still ... crap 2021-01-01 15:39:06 -08:00
R Tyler Croy e2a5f74c3a More refactoring to clean up the ssh transport a bit 2021-01-01 15:14:21 -08:00
R Tyler Croy c6d62687b4 Add Transport.file_exists to clean up the run method for builtin tasks 2021-01-01 15:03:14 -08:00
R Tyler Croy 4888aa9ecf Make the .ztask suffix not required when loading in the zplan
Fixes #3
2021-01-01 14:41:42 -08:00
R Tyler Croy 50ab1a5b14 Restructuring the file tree to make it easier to start adding "native tasks"
Some number of tasks I will want to be "builtin" and need to know a little bit
more about the transport in order to make that work.

The traits, they are coming.

See #1
2021-01-01 14:32:51 -08:00
R Tyler Croy a3d6980f71 Update readme for new version 2021-01-01 11:37:36 -08:00
R Tyler Croy 6e0c76dd70 Add disconnect to the Transport trait to allow groups to be properly run
Since I refactored a Transport to allow for maintaining a connection, subsequent
commands were being run on the same target. This ensures that when a group is
being run, that the session is flushed between connections
2021-01-01 11:13:07 -08:00
R Tyler Croy 3ae98839c7 Add some getting started documentation 2021-01-01 10:47:07 -08:00
R Tyler Croy 56683f2288 Rename the zap-cli package to allow for publishing to crates.io 2021-01-01 10:25:27 -08:00
R Tyler Croy 40ae75bff1 Add necessary details to publish to crates.io 2021-01-01 10:19:22 -08:00
R Tyler Croy 872157ce98 Move the ExecutableTask to the root of zap-models 2021-01-01 10:14:58 -08:00
R Tyler Croy a3accf213a Refactor the parser package into a "model" package which is more accurate
Most of its job is to contain the models for different data structures
2021-01-01 10:10:01 -08:00
R Tyler Croy 5003d5eeff Add some comments to all the existing defined ztasks 2021-01-01 10:08:17 -08:00
R Tyler Croy a39a994062 Use the right rule when parsing the tasks
This mistake was causing ztask files not to allow preceding comments and
whitespace at the top of the file.
2021-01-01 10:03:59 -08:00
R Tyler Croy fc1f951c19 Starting to put together a little FreeBSD-based web application example
Not yet done, but enough for now
2020-12-31 22:43:18 -08:00
R Tyler Croy 46dbe64f5f Add a simple /bin/sh task 2020-12-31 22:43:07 -08:00
R Tyler Croy b0cb6533c0 Disable handlebars escaping so things like shell redirects >> work properly 2020-12-31 22:42:42 -08:00
R Tyler Croy d605bc4229 Support the `unless` parameter on a task to run a little script for idempotency 2020-12-31 22:42:23 -08:00
R Tyler Croy bc4396a0de Refactor the SSH transport to make it easy to re-send files
This also has some refactor to ensure that a set up transport stays connected
instead of reconnecting for each "run"
2020-12-31 21:53:19 -08:00
R Tyler Croy 7e3d7fb5ad Add a --dry-run argument to plan/task so that you can see what scripts will be run 2020-12-31 15:38:14 -08:00
R Tyler Croy dc1c67cf28 Add some package install tasks 2020-12-31 15:25:50 -08:00
R Tyler Croy 184d455b2d Add the `check` command to check the validity of zplan and ztask files 2020-12-31 15:24:55 -08:00
R Tyler Croy 59d44d7e0f Tweak the readme a bit to include recent syntax changes 2020-12-31 14:40:08 -08:00
R Tyler Croy b35801a609 Support the provides parameter to allow tasks to have some level of idempotency 2020-12-31 14:37:48 -08:00
R Tyler Croy d5b8cb6dfc Clean up missing copy/pasta between task and plan parsing 2020-12-31 14:26:11 -08:00
R Tyler Croy d765cc5703 Support invoking a task with a file-based script via an args file
Basically the first parameter to the invoked task-file will be an args-file of
JSON-encoded parameters and values.

    ./my-special-script ._zap_args
2020-12-31 14:20:07 -08:00
R Tyler Croy eda6f523a3 Major refactor to cleanly run tasks from files or inline
ExecutableTask needs to find a new home, and some other things still need to get
shuffled around. This commit does however copy a temp file over for execution
which seems to be the best possible scenario for safe execution

An example run:

❯ RUST_LOG=debug ./target/debug/zap task tasks/shell/bash.ztask -p "script=set -xe; pwd" -t zap-freebsd
Running task with: TaskOpts { task: "tasks/shell/bash.ztask", parameter: ["script=set -xe; pwd"], targets: "zap-freebsd" }
 INFO  zap > Task located, preparing to execute
 DEBUG handlebars::render > Rendering value: Path(Relative(([Named("script")], "script")))
 DEBUG handlebars::context > Accessing context value: AbsolutePath(["script"])
err: + pwd
/root
2020-12-31 13:48:07 -08:00
R Tyler Croy 865850bd64 Clean up the readme 2020-12-31 11:19:05 -08:00
R Tyler Croy baab4610ac Add a license 2020-12-31 11:16:45 -08:00
R Tyler Croy fbde2ed863 Implement the execution of plans via the CLI 2020-12-31 11:10:12 -08:00
R Tyler Croy 8981370222 Refactoring the parsing code a fair bit to make way for the zplan parser
Turns out that a single module using #[derive(Parser)] cannot have two parsers
in the same module
2020-12-31 09:48:39 -08:00
R Tyler Croy a7efcc6085 Switch ztasks to be file-based
Played around with using symbols, and figuring out the namespacing is going to
be too much of a pain in the ass
2020-12-31 09:30:04 -08:00
R Tyler Croy ff3f3c5263 Move away from environment variables and switch to rendering scripts as handlebars
This will make sure there's a better cross-platform approach for getting
parameters into these commands.
2020-12-31 09:20:22 -08:00
R Tyler Croy 754fd428f8 Allow passing some configuration for user/password on SSH
With some real integration testing it looks like the "set an environment
variable" approach is not really going to work effectively.

I think the script {} will need to be treated like a template instead, since
different shells require different ways of setting env variables and it doesn't
appear that there's a good ssh2-based way to set these environment variables.
2020-12-30 22:46:29 -08:00
R Tyler Croy 7b9066d096 Implement the simple support for running a task
This includes an echo task for funsies
2020-12-30 21:11:35 -08:00
R Tyler Croy b00e9835e8 Allow parameters inside of a task to be optional.
I can imagine a few cases where there wouldn't be any parameters needed
2020-12-30 14:40:52 -08:00
R Tyler Croy 904bf007ce Start working on the task definition parsing grammar, pretty easy. 2020-12-30 14:27:33 -08:00
R Tyler Croy 97ae0d52a6 Add more sketches 2020-12-30 09:43:02 -08:00
R Tyler Croy 0bdd2ba9bc Add some sketches of what tasks and plans might look like 2020-12-29 22:16:52 -08:00
R Tyler Croy 822eceb0d6 Refactor some code to make the Ssh a "transport"
I'm still not thrilled with the need to hard-code some things here, and tried to
use the enum_dispatch crate to make the transport mapping go directly from
inventory::Transport to transport::Ssh. Didn't work because it needs to be
struct/tuple syntax
2020-12-29 16:50:01 -08:00
R Tyler Croy e82ca1eff0 Allow running commands across a group 2020-12-28 22:34:48 -08:00
R Tyler Croy b66d6824bc Play around with simple SSH commands 2020-12-28 22:12:45 -08:00
R Tyler Croy 523491eed4 Initial commit 2020-12-28 16:46:39 -08:00