minop

command module
v0.0.27 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2026 License: GPL-3.0 Imports: 1 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

MINOP

A simple tool for remote task orchestration and batch execution.

English · 简体中文

Action Status Codecov Go Report Card Go Reference Git tag Go Version


Installation

Install from Source

To install minop from source, ensure you have Go installed and run:

go install github.com/cqroot/minop@latest

Download Pre-compiled Binaries

Download the binary for your platform from the releases page and add its directory to your system's PATH.

Features

  • Batch SSH execution — run shell commands on every host in hosts.yaml concurrently (default 10, tunable via --max-procs).
  • File & directory uploads — built-in copy task with optional backup: true that preserves any pre-existing remote file.
  • Local commands — run shell snippets on the minop host itself, useful for orchestration glue.
  • Interactive REPL — minop cli opens a TUI where every input line is dispatched to all targets; output scrolls above a pinned input box with hint shortcuts.
  • Ansible-style task syntax — minop.yaml follows the "action key as type" convention familiar to ansible users: shell:, local:, and copy: each pick the operation type by their key, no explicit type: field required.
  • Inspection commands — minop host prints the parsed host tree; minop task lists every task in minop.yaml without executing.

Usage

minop reads two configuration files:

File Flag Purpose
hosts.yaml -H / --hosts-file Hosts grouped by role. Stable across runs; usually version-controlled.
minop.yaml -t / --task Tasks to execute. Changes from run to run.

Both files are looked up in the current working directory by default.

Hosts File (hosts.yaml)

A flat YAML map from role name to a list of host strings in the format <user>:<password>@<address>:<port>. The role named all is special: every task targets it unless the task specifies a different role.

all:
  - root:PASSWORD@127.0.0.1:8001

main:
  - root:PASSWORD@127.0.0.1:8002
  - root:PASSWORD@127.0.0.1:8003

Tasks File (minop.yaml)

A list of tasks under the tasks key. Each task declares exactly one action — the action key itself picks the operation type, no separate type: field is needed.

Action key Operation Body
shell: <cmd> run on every target host command string
local: <cmd> run on the minop host command string
copy: {...} upload a file or directory nested object
tasks:
  - name: Copy a file to the remote host
    copy:
      src: test.txt
      dest: /tmp/test.txt

  - name: Copy a directory to the remote host
    copy:
      src: testdir
      dest: /tmp/testdir

  - name: List /tmp on the remote host
    shell: ls /tmp

copy accepts an optional backup: true flag — when set, any pre-existing remote file at dest is renamed to dest.minop_bak before the upload.

Run Tasks

minop run                   # use ./hosts.yaml and ./minop.yaml
minop run -H ./prod-hosts.yaml  # custom hosts file
minop run -t ./deploy.yaml      # custom tasks file
minop run -p 20                 # run with concurrency 20 (default 10)

Inspect Configuration

minop host                  # show the parsed hosts as a tree
minop task                  # list the tasks defined in minop.yaml

Interactive CLI

minop cli                   # REPL: type a command, hit Enter, run on every host

Type exit (or quit) to leave the CLI, and help to see built-in shortcuts.

Contributing

Contributions are welcome! Feel free to open an issue to report bugs, suggest new features, or submit a pull request.

License

This project is open source, licensed under the GPL-3.0 License.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
cli
theme
Package theme centralises the lipgloss styles used across the command, executor, CLI, and version packages.
Package theme centralises the lipgloss styles used across the command, executor, CLI, and version packages.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL