Fix private key
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
ci/woodpecker/tag/woodpecker Pipeline was successful

This commit is contained in:
SebClem 2023-07-04 17:54:42 +02:00
parent 619e6d726f
commit 5f834c7388
Signed by: sebclem
GPG Key ID: 5A4308F6A359EA50

View File

@ -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...)
}