diff --git a/db_lib/AnsiblePlaybook.go b/db_lib/AnsiblePlaybook.go index e75eba54..f52cbb3a 100644 --- a/db_lib/AnsiblePlaybook.go +++ b/db_lib/AnsiblePlaybook.go @@ -6,10 +6,10 @@ import ( "os/exec" "strings" + "github.com/creack/pty" "github.com/semaphoreui/semaphore/db" "github.com/semaphoreui/semaphore/pkg/task_logger" "github.com/semaphoreui/semaphore/util" - "github.com/creack/pty" ) type AnsiblePlaybook struct { @@ -24,6 +24,7 @@ func (p AnsiblePlaybook) makeCmd(command string, args []string, environmentVars cmd.Env = append(cmd.Env, "PYTHONUNBUFFERED=1") cmd.Env = append(cmd.Env, "ANSIBLE_FORCE_COLOR=True") + cmd.Env = append(cmd.Env, "ANSIBLE_HOST_KEY_CHECKING=False") cmd.Env = append(cmd.Env, getEnvironmentVars()...) cmd.Env = append(cmd.Env, fmt.Sprintf("HOME=%s", util.Config.TmpPath)) cmd.Env = append(cmd.Env, fmt.Sprintf("PWD=%s", cmd.Dir)) diff --git a/db_lib/LocalApp.go b/db_lib/LocalApp.go index e75f8aa7..61b7c27a 100644 --- a/db_lib/LocalApp.go +++ b/db_lib/LocalApp.go @@ -13,29 +13,15 @@ func getEnvironmentVars() []string { fmt.Sprintf("PATH=%s", os.Getenv("PATH")), } - hasHostKeyCheckingFlag := false - for _, e := range util.Config.ForwardedEnvVars { v := os.Getenv(e) if v != "" { res = append(res, fmt.Sprintf("%s=%s", e, v)) } - - if e == "ANSIBLE_HOST_KEY_CHECKING" { - hasHostKeyCheckingFlag = true - } } for k, v := range util.Config.EnvVars { res = append(res, fmt.Sprintf("%s=%s", k, v)) - - if k == "ANSIBLE_HOST_KEY_CHECKING" { - hasHostKeyCheckingFlag = true - } - } - - if !hasHostKeyCheckingFlag { - res = append(res, "ANSIBLE_HOST_KEY_CHECKING=False") } return res diff --git a/db_lib/LocalApp_test.go b/db_lib/LocalApp_test.go index 016e652f..ce3ca5bf 100644 --- a/db_lib/LocalApp_test.go +++ b/db_lib/LocalApp_test.go @@ -36,7 +36,6 @@ func TestGetEnvironmentVars(t *testing.T) { expected := []string{ "SEMAPHORE_TEST=test123", "ANSIBLE_FORCE_COLOR=False", - "ANSIBLE_HOST_KEY_CHECKING=False", "PATH=", }