Fix private key
This commit is contained in:
parent
619e6d726f
commit
5f834c7388
@ -4,6 +4,7 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"go.uber.org/zap"
|
||||
"go.uber.org/zap/zapcore"
|
||||
@ -153,6 +154,9 @@ func main() {
|
||||
if pluginConfig.privateKey != nil {
|
||||
sugar.Info("🔑 Adding ssh key to .ssh/id_ed25519")
|
||||
os.MkdirAll("/root/.ssh", 0700)
|
||||
if !strings.HasSuffix(*pluginConfig.privateKey, "\n") {
|
||||
*pluginConfig.privateKey = *pluginConfig.privateKey + "\n"
|
||||
}
|
||||
err := os.WriteFile("/root/.ssh/id_ed25519", []byte(*pluginConfig.privateKey), 0400)
|
||||
if err != nil {
|
||||
sugar.Fatal(err)
|
||||
@ -214,7 +218,6 @@ func main() {
|
||||
args = append(args, "--tags", *pluginConfig.tags)
|
||||
}
|
||||
|
||||
// runCommand(sugar, "export", "ANSIBLE_HOST_KEY_CHECKING=False")
|
||||
command := append([]string{"ansible-playbook"}, args...)
|
||||
runCommand(sugar, command...)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user