Skip to content

Commit

Permalink
Add komando_parallel_hosts and komando_parallel_tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
hahnavi committed Dec 26, 2024
1 parent 9ba8668 commit 089078e
Show file tree
Hide file tree
Showing 15 changed files with 662 additions and 271 deletions.
55 changes: 51 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ mlua = { version = "0.10.1", features = [
"vendored",
] }
rand = "0.8.5"
rayon = "1.10.0"
regex = "1.11.1"
rustyline = "15.0.0"
serde = { version = "1.0.216", features = ["derive"] }
serde_json = "1.0.133"
ssh2 = { version = "0.9.4", features = ["vendored-openssl"] }

Expand Down
29 changes: 29 additions & 0 deletions examples/parallel_hosts.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
local hosts = {
{
name = "server1",
address = "localhost",
user = "usertest",
private_key_file = os.getenv("HOME") .. "/.ssh/id_ed25519",
},
{
name = "server2",
address = "localhost",
user = "usertest",
private_key_file = os.getenv("HOME") .. "/.ssh/id_ed25519",
},
{
name = "server3",
address = "localhost",
user = "usertest",
private_key_file = os.getenv("HOME") .. "/.ssh/id_ed25519",
}
}

local task = {
name = "Ping Google",
komandan.modules.cmd({
cmd = "ping google.com -c 5",
}),
}

komandan.komando_parallel_hosts(hosts, task)
31 changes: 31 additions & 0 deletions examples/parallel_tasks.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
local host = {
name = "My Server",
address = "localhost",
user = "usertest",
private_key_file = os.getenv("HOME") .. "/.ssh/id_ed25519",
}

local tasks = {
{
name = "Task 1",
komandan.modules.cmd({
cmd = "uname -a",
}),
},
{
name = "Task 2",
komandan.modules.cmd({
cmd = "ping google.com -c 7",
}),
},
{
name = "Task 3",
komandan.modules.apt({
package = "neovim",
update_cache = true
}),
elevate = true,
}
}

komandan.komando_parallel_tasks(host, tasks)
Loading

0 comments on commit 089078e

Please sign in to comment.