Zap - A simple cross-platform configuration management and orchestration tool

Related tags

Configuration zap
Overview

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.

Getting Started

Zap is still very early in its development, but if you would like to give it a try you can install it via Rustโ€™s cargo command: cargo install zap-cli.

cargo install zap-cli
mkdir my-zap-project
cd my-zap-project
wget https://github.com/rtyler/zap/archive/v0.1.1.tar.gz
tar -zxvf v0.1.1.tar.gz zap-0.1.1/tasks -C tasks --strip=1
cat > hello.zplan <<EOF
task 'tasks/echo.ztask' {
    msg = 'Show them my medal Kif'
}
EOF

You will also need to create an inventory file.

Example inventory.yml
groups: []
targets:
  - name: alpha
    uri: 192.168.1.1
    config:
      ssh:
        user: root
        password: root

config:
  transport: ssh

Once this has been set up, you can run:

zap plan hello.zplan -t alpha --dry-run

Command Line

The zap command line interface has a number of subcommands that can help with the development and deployment of tasks and plans.

cmd

check

plan

task

Examples

โฏ zap task tasks/echo.ztask -p msg="Hello World" -t zap-freebsd
Running task with: TaskOpts { task: "tasks/echo.ztask", parameter: ["msg=Hello World"], targets: "zap-freebsd" }
Hello World
โฏ zap plan ./examples/basic.zplan -t zap-freebsd
Running plan with: PlanOpts { plan: "./examples/basic.zplan", targets: "zap-freebsd" }
Hello from the wonderful world of zplans!
This is nice

Task

A task is a simple container of some form of execution. Typically this will be a wrapped shell/ruby/python script which does some specific piece of functionality. Tasks may also take parameters, which allow for some pluggability of new values.

Tasks have some default parameters that should not be overridden in new task definitions.

Table 1. Built-in Parameters
Parameter Description

provides

A relative or absolute path to a file that the task provides. If the file exists, then the task will be skipped.

unless

A script snippet which can determine whether the task should execute. A non-zero exit status causes the task to execute.

echo.ztask
task Echo {
    parameters {
        msg {
            required = true
            help = 'String to echo back to the client'
            type = string
        }
    }

    script {
        inline = 'echo {{msg}}'
    }
}

Plan

A plan is a collection of tasks which can be applied to a target or targets. Tasks are referenced with the parameters that should be passed into them, and will be executed in the order that they are defined.

simple.zplan
task 'tasks/echo' {
    msg = 'Hello from the wonderful world of zplans!'
}

task 'tasks/echo' {
    msg = 'This is nice'
}

Built-in Tasks

Zap comes with a number of tasks that are built into zap itself. These can be referenced in the task declarations in plans via the zap:// URL.

sh

The sh task will execute the given script via /bin/sh on the target.

Example
task 'zap://sh' {
    script = '''
        pwd
        echo ${SHELL}
    '''
}
Table 2. Parameter
Name Required Description

script

yes

A shell script

provides

no

When this file is present indicates that the script should not be re-run

unless

no

When this script returns zero exit status, the script should not be re-run

You might also like...
An opinionated, monolithic template for Bevy with cross-platform CI/CD, native + WASM launchers, and managed cross-platform deployment.
An opinionated, monolithic template for Bevy with cross-platform CI/CD, native + WASM launchers, and managed cross-platform deployment.

๐Ÿ•Š๏ธ Bevy Shell - Template An opinionated, monolithic template for Bevy with cross-platform CI/CD, native + WASM launchers, and managed cross-platform

Cross-platform, cross-browser, cross-search-engine duckduckgo-like bangs

localbang Cross-platform, cross-browser, cross-search-engine duckduckgo-like bangs What are "bangs"?? Bangs are a way to define where to search inside

A blazingly fast static web server with routing, templating, and security in a single binary you can set up with zero code. :zap::crab:
A blazingly fast static web server with routing, templating, and security in a single binary you can set up with zero code. :zap::crab:

binserve โšก ๐Ÿฆ€ A blazingly fast static web server with routing, templating, and security in a single binary you can set up with zero code. ๐Ÿ”ฅ UPDATE: N

Rust File Management CLI is a command-line tool written in Rust that provides essential file management functionalities. Whether you're working with files or directories, this tool simplifies common file operations with ease.

Rust FileOps Rust File Management CLI is a command-line tool written in Rust that provides essential file management functionalities. Whether you're w

wireguard tool to manage / generate configuration. Maintain one yaml configuration file to quickly build wireguard network.

wgx wireguard tool to manage / generate configuration. Maintain one yaml configuration file to quickly build wireguard network. Usage wgx --h USAGE:

gobang - A cross-platform TUI database management tool written in Rust
gobang - A cross-platform TUI database management tool written in Rust

gobang - A cross-platform TUI database management tool written in Rust

:zap: fast http framework for rust

zap โšก The mission of zap is, to deliver a basic, but fast rust web server library. Documentation About This code is based on tokio's minihttp project,

Microunit is a decentralized unit orchestration framework.

Microunit is a decentralized unit orchestration framework.

Core Lightning plugin for sending zap (NIP-57) notes

Core Lightning plugin for sending zap events You can add the plugin by copying it to CLN's plugin directory or by adding the following line to your co

Kuintessence - Open Source HPC Computing Orchestration System
Kuintessence - Open Source HPC Computing Orchestration System

Kuintessence is an advanced computing orchestration system designed to revolutionize HPC workload and cluster management, to empower HPC users by allowing them to concentrate on their scientific ideas rather than getting bogged down by HPC environment complications, and enhance research productivity to its fullest potential.

A systemd-boot configuration and boot entry configuration parser library

A systemd-boot configuration and boot entry configuration parser library

Kusion Configuration Language (KCL) is an open source configuration language mainly used in Kusion Stack

Kusion Configuration Language (KCL) is an open source configuration language mainly used in Kusion Stack. KCL is a statically typed language for configuration and policy scenarios, based on concepts such as declarative and Object-Oriented Programming (OOP) paradigms.

A fast, simple and powerful open-source cross platform utility tool for generating strong, unique and random passwords

password-generator-pro A fast, simple and powerful open-source cross platform utility tool for generating strong, unique and random passwords. Feature

Fusion is a cross-platform App Dev ToolKit build on Rust . Fusion lets you create Beautiful and Fast apps for mobile and desktop platform.
Fusion is a cross-platform App Dev ToolKit build on Rust . Fusion lets you create Beautiful and Fast apps for mobile and desktop platform.

Fusion is a cross-platform App Dev ToolKit build on Rust . Fusion lets you create Beautiful and Fast apps for mobile and desktop platform.

This is a `Rust` based package to help with the management of complex medicine (pill) management cycles.
This is a `Rust` based package to help with the management of complex medicine (pill) management cycles.

reepicheep This is a Rust based package to help with the management of complex medicine (pill) management cycles. reepicheep notifies a person(s) via

zzhack-cli is a Command Tool to help you quickly generate a WASM WebApp with simple configuration and zero code
zzhack-cli is a Command Tool to help you quickly generate a WASM WebApp with simple configuration and zero code

English | ไธญๆ–‡ๆ–‡ๆกฃ zzhack-cli is a Command Tool that can help you quickly generate a WASM WebApp with simple configuration and zero code. It's worth menti

Habitat is open source software that creates platform-independent build artifacts and provides built-in deployment and management capabilities.
Habitat is open source software that creates platform-independent build artifacts and provides built-in deployment and management capabilities.

Habitat is open source software that creates platform-independent build artifacts and provides built-in deployment and management capabilities. The go

Like pigz, but rust - a cross platform, fast, compression and decompression tool.

๐Ÿฆ€ crabz Like pigz, but rust. A cross platform, fast, compression and decompression tool. Synopsis This is currently a proof of concept CLI tool using

Comments
  • Build static MUSL target with vendored openssl

    Build static MUSL target with vendored openssl

    Rust is capable of building binaries which carry their own MUSL libc internally for operation on almost any userspace provided that the kernel ABI (signals and such) is compatible with the platform target selected. This project runs into OpenSSL dependency problems when building a MUSL target as the host libraries are generally built for GNU. Address the concern by providing a vendored openssl, which permits building for the target via cargo build --features vendored with the relevant release and target/toolchain invocation.

    Testing: This patch is applied to our internal PKGBUILD, producing working binaries.

    opened by sempervictus 3
  • Provide a pluggable executor for tasks

    Provide a pluggable executor for tasks

    I'm thinking a lot more about how scripts are invoked on machines. Perhaps rather than providing transport-level privilege escalation via #2, instead the "shell executor" shouldn't just be a dumb /bin/sh but rather something configurable at run time.

    • ShellExecutor (/bin/sh scriptfile)
    • SudoExecutor (sudo scriptfile)
    • JailShell ([sudo] jexec scriptfile)

    Each of these should probably have some form of options, but I don't believe they need to necessarily be options specified at task time :thinking:

    (thinking out loud)

    Perhaps a plan should be able to define the executor and configuration for it. For example, if I have a plan that sets up PostgreSQL in a jail, the plan would specify the details about the jail for jexec.

    enhancement 
    opened by rtyler 0
  • Exit plan on first failed task

    Exit plan on first failed task

    โฏ RUST_LOG=info ./target/debug/zap plan examples/basic.zplan -t bsd
    Running plan with: PlanOpts { plan: "examples/basic.zplan", targets: "bsd", dry_run: false }
     ERROR zap_model::plan > Failed to parse task: Error { variant: CustomError { message: "No such file or directory (os error 2)" }, location: Pos(0), line_col: Pos((1, 1)), path: None, line: "", continued_line: None }
     ERROR zap_model::plan > Failed to parse task: Error { variant: CustomError { message: "No such file or directory (os error 2)" }, location: Pos(0), line_col: Pos((1, 1)), path: None, line: "", continued_line: None }
     ERROR zap_model::plan > Failed to parse task: Error { variant: CustomError { message: "No such file or directory (os error 2)" }, location: Pos(0), line_col: Pos((1, 1)), path: None, line: "", continued_line: None }
     INFO  zap             > Plan located, preparing to execute
    
    

    Basically after that first one zap should bail

    bug good first issue 
    opened by rtyler 2
  • Consider allowing `provides` to take an array

    Consider allowing `provides` to take an array

    For some tasks like the install tasks with packages, there's no way to currently say that the packages may result in multiple files.

    Basically, provides = ['/usr/local/sbin/nginx', '/usr/local/sbin/mdnsd'] would allow the task to be run if both files don't exist.

    enhancement 
    opened by rtyler 0
Owner
R. Tyler Croy
person
R. Tyler Croy
Kusion Configuration Language (KCL) is an open source configuration language mainly used in Kusion Stack

Kusion Configuration Language (KCL) is an open source configuration language mainly used in Kusion Stack. KCL is a statically typed language for configuration and policy scenarios, based on concepts such as declarative and Object-Oriented Programming (OOP) paradigms.

KusionStack 264 Dec 30, 2022
๐ŸŒฝ A simple and pain-free configuration language.

?? Corn A simple and pain-free configuration language. Corn has been designed using inspiration from JSON and Nix to produce a language that's easy an

Jake Stanger 3 Nov 28, 2022
Just-config is a configuration library for rust

Config Library for Rust Just-config is a configuration library for rust. It strives for the old Unix mantra "Do one thing and to it well".

FlashSystems 7 Apr 15, 2022
Uclicious is a flexible reduced boilerplate configuration framework.

Uclicious What is Uclicious Usage Raw API Derive-driven Validators Type Mapping Supported attributes (#[ucl(..)]) Structure level Field level Addition

Andrey Cherkashin 14 Aug 12, 2022
A Rust library for processing application configuration easily

Configure me A Rust library for processing application configuration easily About This crate aims to help with reading configuration of application fr

Martin Habovลกtiak 48 Dec 18, 2022
โš™๏ธ Layered configuration system for Rust applications (with strong support for 12-factor applications).

config-rs Layered configuration system for Rust applications (with strong support for 12-factor applications). Set defaults Set explicit values (to pr

Ryan Leckey 1.8k Jan 9, 2023
cfg-rs: A Configuration Library for Rust Applications

cfg-rs: A Configuration Library for Rust Applications Major Features One method to get all config objects, see get. Automatic derive config object, se

Daniel YU 20 Dec 16, 2022
hosts file parsing, modification library, and some derivatives.

hosts-rs hosts: Hosts file parsing, modification library resolve-github: Use Cloudflare DoH to resolve GitHub domains and generate hosts files github-

zu1k 33 Jul 4, 2022
A rust layered configuration loader with zero-boilerplate configuration management.

salak A layered configuration loader with zero-boilerplate configuration management. About Features Placeholder Key Convension Cargo Features Default

Daniel YU 28 Sep 20, 2022
A simple cross-platform remote file management tool to upload and download files over HTTP/S

A simple cross-platform remote file management tool to upload and download files over HTTP/S

sexnine 13 Dec 30, 2022