2026-04-03 11:11:17 +00:00
|
|
|
package ansiblecmd
|
2026-03-09 12:28:25 +00:00
|
|
|
|
|
|
|
|
import (
|
2026-03-22 01:50:56 +00:00
|
|
|
"dappco.re/go/core"
|
2026-03-09 12:28:25 +00:00
|
|
|
)
|
|
|
|
|
|
2026-04-03 11:11:17 +00:00
|
|
|
// Register registers the `ansible` command and its `ansible/test` subcommand.
|
2026-03-26 16:39:59 +00:00
|
|
|
//
|
|
|
|
|
// Example:
|
|
|
|
|
//
|
|
|
|
|
// var app core.Core
|
|
|
|
|
// Register(&app)
|
2026-03-22 01:50:56 +00:00
|
|
|
func Register(c *core.Core) {
|
|
|
|
|
c.Command("ansible", core.Command{
|
|
|
|
|
Description: "Run Ansible playbooks natively (no Python required)",
|
2026-04-03 11:11:17 +00:00
|
|
|
Action: runPlaybookCommand,
|
2026-03-26 14:47:37 +00:00
|
|
|
Flags: core.NewOptions(
|
|
|
|
|
core.Option{Key: "inventory", Value: ""},
|
2026-04-02 00:27:36 +00:00
|
|
|
core.Option{Key: "i", Value: ""},
|
2026-03-26 14:47:37 +00:00
|
|
|
core.Option{Key: "limit", Value: ""},
|
2026-04-02 00:27:36 +00:00
|
|
|
core.Option{Key: "l", Value: ""},
|
2026-03-26 14:47:37 +00:00
|
|
|
core.Option{Key: "tags", Value: ""},
|
2026-04-02 00:27:36 +00:00
|
|
|
core.Option{Key: "t", Value: ""},
|
2026-03-26 14:47:37 +00:00
|
|
|
core.Option{Key: "skip-tags", Value: ""},
|
|
|
|
|
core.Option{Key: "extra-vars", Value: ""},
|
2026-04-02 00:27:36 +00:00
|
|
|
core.Option{Key: "e", Value: ""},
|
2026-03-26 14:47:37 +00:00
|
|
|
core.Option{Key: "verbose", Value: 0},
|
2026-04-02 00:27:36 +00:00
|
|
|
core.Option{Key: "v", Value: false},
|
2026-03-26 14:47:37 +00:00
|
|
|
core.Option{Key: "check", Value: false},
|
2026-04-01 20:22:39 +00:00
|
|
|
core.Option{Key: "diff", Value: false},
|
2026-03-26 14:47:37 +00:00
|
|
|
),
|
2026-03-22 01:50:56 +00:00
|
|
|
})
|
2026-03-09 12:28:25 +00:00
|
|
|
|
2026-03-22 01:50:56 +00:00
|
|
|
c.Command("ansible/test", core.Command{
|
|
|
|
|
Description: "Test SSH connectivity to a host",
|
2026-04-03 11:11:17 +00:00
|
|
|
Action: runSSHTestCommand,
|
2026-03-26 14:47:37 +00:00
|
|
|
Flags: core.NewOptions(
|
|
|
|
|
core.Option{Key: "user", Value: "root"},
|
2026-04-02 00:27:36 +00:00
|
|
|
core.Option{Key: "u", Value: "root"},
|
2026-03-26 14:47:37 +00:00
|
|
|
core.Option{Key: "password", Value: ""},
|
|
|
|
|
core.Option{Key: "key", Value: ""},
|
2026-04-01 23:24:17 +00:00
|
|
|
core.Option{Key: "i", Value: ""},
|
2026-03-26 14:47:37 +00:00
|
|
|
core.Option{Key: "port", Value: 22},
|
|
|
|
|
),
|
2026-03-22 01:50:56 +00:00
|
|
|
})
|
2026-03-09 12:28:25 +00:00
|
|
|
}
|