Fix: Remove unwanted extra args 95/71895/2 v0.14.1
authorAnil Belur <abelur@linuxfoundation.org>
Tue, 4 Jul 2023 07:38:19 +0000 (17:38 +1000)
committerAnil Belur <abelur@linuxfoundation.org>
Tue, 4 Jul 2023 12:00:40 +0000 (22:00 +1000)
RSA/SHA-1 was deprecated since the OpenSSH release 8.8.
This causes builds with latest version of packer to fail with the
below error:

Error:

Data could not be sent to remote host "127.0.0.1". Make sure this
host can be reached over ssh: command-line: line 0: Bad
configuration option: pubkeyacceptedalgorithms.

Add workaroud and pass required HostKeyAlgorithms through ssh extra
argumements. Testing with cloud builds and since we are using multiple
flavors the only options required are "IdentitiesOnly=yes"
and "HostKeyAlgorithms=+ssh-rsa".

Issue: RELENG-4764
Ref: https://github.com/hashicorp/packer-plugin-ansible/issues/69
Change-Id: I80ff152d5153d739d6586c217fbc392e8be80f2a
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
releasenotes/notes/fix-templates-ssh-hostkeyalgos-3b1088d7187e0ec9.yaml [new file with mode: 0644]
templates/builder-aws.pkr.hcl
templates/builder.pkr.hcl
templates/devstack-pre-pip-yoga.pkr.hcl
templates/devstack.pkr.hcl
templates/docker-aws.pkr.hcl
templates/docker.pkr.hcl
templates/windows-builder.pkr.hcl

diff --git a/releasenotes/notes/fix-templates-ssh-hostkeyalgos-3b1088d7187e0ec9.yaml b/releasenotes/notes/fix-templates-ssh-hostkeyalgos-3b1088d7187e0ec9.yaml
new file mode 100644 (file)
index 0000000..d7aa198
--- /dev/null
@@ -0,0 +1,13 @@
+---
+issues:
+  - |
+    RSA/SHA-1 was deprecated in the latest OpenSSH release 8.8
+    causing builds fail with the following error:
+
+    Data could not be sent to remote host "127.0.0.1". Make sure this host
+    can be reached over ssh: command-line: line 0: Bad configuration
+    option: pubkeyacceptedalgorithms
+fixes:
+  - |
+    Add workaroud and pass required HostKeyAlgorithms through ssh extra
+    argumements.
index 0878e63..448331e 100644 (file)
@@ -181,8 +181,7 @@ build {
     ]
     command            = "./common-packer/ansible-playbook.sh"
     extra_arguments    = [
-        "--scp-extra-args", "'-O'",
-        "--ssh-extra-args", "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa"
+        "--ssh-extra-args", "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa"
     ]
     playbook_file      = "provision/local-builder.yaml"
     skip_version_check = true
index 25e7c7b..ab331b0 100644 (file)
@@ -143,9 +143,18 @@ build {
   }
 
   provisioner "ansible" {
-    ansible_env_vars   = ["ANSIBLE_NOCOWS=1", "ANSIBLE_PIPELINING=True", "ANSIBLE_ROLES_PATH=${var.ansible_roles_path}", "ANSIBLE_CALLBACK_WHITELIST=profile_tasks", "ANSIBLE_STDOUT_CALLBACK=debug"]
+    ansible_env_vars   = [
+        "ANSIBLE_NOCOWS=1",
+        "ANSIBLE_PIPELINING=False",
+        "ANSIBLE_HOST_KEY_CHECKING=False",
+        "ANSIBLE_ROLES_PATH=${var.ansible_roles_path}",
+        "ANSIBLE_CALLBACK_WHITELIST=profile_tasks",
+        "ANSIBLE_STDOUT_CALLBACK=debug"
+    ]
     command            = "./common-packer/ansible-playbook.sh"
-    extra_arguments    = ["--scp-extra-args", "'-O'", "--ssh-extra-args", "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa"]
+    extra_arguments    = [
+        "--ssh-extra-args", "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa"
+    ]
     playbook_file      = "provision/local-builder.yaml"
     skip_version_check = true
   }
index 3453914..da3c366 100644 (file)
@@ -146,9 +146,19 @@ build {
   }
 
   provisioner "ansible" {
-    ansible_env_vars   = ["ANSIBLE_DEBUG=False", "ANSIBLE_NOCOWS=1", "ANSIBLE_PIPELINING=True", "ANSIBLE_ROLES_PATH=${var.ansible_roles_path}", "ANSIBLE_CALLBACK_WHITELIST=profile_tasks", "ANSIBLE_STDOUT_CALLBACK=debug"]
+    ansible_env_vars   = [
+        "ANSIBLE_NOCOWS=1",
+        "ANSIBLE_PIPELINING=False",
+        "ANSIBLE_HOST_KEY_CHECKING=False",
+        "ANSIBLE_ROLES_PATH=${var.ansible_roles_path}",
+        "ANSIBLE_CALLBACK_WHITELIST=profile_tasks",
+        "ANSIBLE_STDOUT_CALLBACK=debug"
+    ]
     command            = "./common-packer/ansible-playbook.sh"
-    extra_arguments    = ["--extra-vars", "os_branch=stable/yoga rdo_branch=yoga", "--scp-extra-args", "'-O'", "--ssh-extra-args", "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa"]
+    extra_arguments    = [
+        "--extra-vars", "os_branch=stable/yoga rdo_branch=yoga",
+        "--ssh-extra-args", "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa"
+    ]
     playbook_file      = "provision/devstack-pre-pip-centos.yaml"
     skip_version_check = true
   }
index 9a815e5..13b613b 100644 (file)
@@ -148,9 +148,19 @@ build {
   }
 
   provisioner "ansible" {
-    ansible_env_vars   = ["ANSIBLE_NOCOWS=1", "ANSIBLE_PIPELINING=True", "ANSIBLE_ROLES_PATH=${var.ansible_roles_path}", "ANSIBLE_CALLBACK_WHITELIST=profile_tasks", "ANSIBLE_STDOUT_CALLBACK=debug"]
+    ansible_env_vars   = [
+        "ANSIBLE_NOCOWS=1",
+        "ANSIBLE_PIPELINING=False",
+        "ANSIBLE_HOST_KEY_CHECKING=False",
+        "ANSIBLE_ROLES_PATH=${var.ansible_roles_path}",
+        "ANSIBLE_CALLBACK_WHITELIST=profile_tasks",
+        "ANSIBLE_STDOUT_CALLBACK=debug"
+    ]
     command            = "./common-packer/ansible-playbook.sh"
-    extra_arguments    = ["--scp-extra-args", "'-O'", "--ssh-extra-args", "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa"]
+    extra_arguments    = [
+        "--extra-vars", "os_branch=stable/yoga rdo_branch=yoga",
+        "--ssh-extra-args", "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa"
+    ]
     playbook_file      = "provision/devstack-centos.yaml"
     skip_version_check = true
   }
index 63f0f50..38fb09f 100644 (file)
@@ -171,9 +171,18 @@ build {
   }
 
   provisioner "ansible" {
-    ansible_env_vars   = ["ANSIBLE_NOCOWS=1", "ANSIBLE_PIPELINING=False", "ANSIBLE_HOST_KEY_CHECKING=False", "ANSIBLE_ROLES_PATH=${var.ansible_roles_path}", "ANSIBLE_CALLBACK_WHITELIST=profile_tasks", "ANSIBLE_STDOUT_CALLBACK=debug"]
+    ansible_env_vars   = [
+        "ANSIBLE_NOCOWS=1",
+        "ANSIBLE_PIPELINING=False",
+        "ANSIBLE_HOST_KEY_CHECKING=False",
+        "ANSIBLE_ROLES_PATH=${var.ansible_roles_path}",
+        "ANSIBLE_CALLBACK_WHITELIST=profile_tasks",
+        "ANSIBLE_STDOUT_CALLBACK=debug"
+    ]
     command            = "./common-packer/ansible-playbook.sh"
-    extra_arguments    = ["--scp-extra-args", "'-O'", "--ssh-extra-args", "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa"]
+    extra_arguments    = [
+        "--ssh-extra-args", "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa"
+    ]
     playbook_file      = "provision/local-docker.yaml"
     skip_version_check = true
     user               = "${var.ssh_user}"
index c4ebe54..2282cd2 100644 (file)
@@ -150,16 +150,16 @@ build {
 
   provisioner "ansible" {
     ansible_env_vars   = [
-      "ANSIBLE_NOCOWS=1",
-      "ANSIBLE_PIPELINING=True",
-      "ANSIBLE_ROLES_PATH=${var.ansible_roles_path}",
-      "ANSIBLE_CALLBACK_WHITELIST=profile_tasks",
-      "ANSIBLE_STDOUT_CALLBACK=debug"
+        "ANSIBLE_NOCOWS=1",
+        "ANSIBLE_PIPELINING=False",
+        "ANSIBLE_HOST_KEY_CHECKING=False",
+        "ANSIBLE_ROLES_PATH=${var.ansible_roles_path}",
+        "ANSIBLE_CALLBACK_WHITELIST=profile_tasks",
+        "ANSIBLE_STDOUT_CALLBACK=debug"
     ]
     command            = "./common-packer/ansible-playbook.sh"
     extra_arguments    = [
-      "--scp-extra-args", "'-O'",
-      "--ssh-extra-args", "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa"
+        "--ssh-extra-args", "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa"
     ]
     playbook_file      = "provision/local-docker.yaml"
     skip_version_check = true
index 94065fe..e6759b3 100644 (file)
@@ -148,18 +148,18 @@ build {
 
   provisioner "ansible" {
     ansible_env_vars   = [
-      "ANSIBLE_NOCOWS=1",
-      "ANSIBLE_PIPELINING=True",
-      "ANSIBLE_ROLES_PATH=${var.ansible_roles_path}",
-      "ANSIBLE_CALLBACK_WHITELIST=profile_tasks",
-      "ANSIBLE_STDOUT_CALLBACK=debug"
+        "ANSIBLE_NOCOWS=1",
+        "ANSIBLE_PIPELINING=False",
+        "ANSIBLE_HOST_KEY_CHECKING=False",
+        "ANSIBLE_ROLES_PATH=${var.ansible_roles_path}",
+        "ANSIBLE_CALLBACK_WHITELIST=profile_tasks",
+        "ANSIBLE_STDOUT_CALLBACK=debug"
     ]
     command            = "./common-packer/ansible-playbook.sh"
-    extra_arguments = [
-      "--extra-vars", "ansible_shell_type=powershell",
-      "--extra-vars", "ansible_shell_executable=None",
-      "--scp-extra-args", "'-O'",
-      "--ssh-extra-args", "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa"
+    extra_arguments    = [
+        "--extra-vars", "ansible_shell_type=powershell",
+        "--extra-vars", "ansible_shell_executable=None",
+        "--ssh-extra-args", "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa"
     ]
     playbook_file   = "provision/local-windows-builder.yaml"
     skip_version_check = true