Fix: Add Ansible user param to OpenStack templates 89/73889/2 v0.17.2
authorAnil Belur <abelur@linuxfoundation.org>
Wed, 12 Nov 2025 12:52:55 +0000 (22:52 +1000)
committerAnil Belur <abelur@linuxfoundation.org>
Wed, 12 Nov 2025 13:09:02 +0000 (23:09 +1000)
The Ansible provisioner in OpenStack templates was missing the 'user'
parameter, causing Ansible to default to the wrong user account when
connecting to instances. This resulted in SCP failures with errors
like:

scp: dest open '~runner/.ansible/tmp/...': No such file or directory

Root cause: During the HCL2 conversion (commit 6e2fdc9), AWS
templates were created with 'user = "${var.ssh_user}"' but OpenStack
templates were not. This was an oversight that went undetected.

This fix adds the 'user' parameter to match the AWS template pattern,
ensuring Ansible uses the correct SSH user (ubuntu/centos/cloud-user)
as defined in the vars files.

Templates updated:
- builder.pkr.hcl
- docker.pkr.hcl
- devstack.pkr.hcl
- devstack-pre-pip-yoga.pkr.hcl
- windows-builder.pkr.hcl

Backward compatibility: This change is fully backward compatible as:
1. The ssh_user variable already exists in all vars files
2. AWS templates already use this pattern successfully
3. No existing Jenkins jobs are affected (they already work)

Change-Id: I985e8a4e8742b3b04ec024c6799bcc5feb908098
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
releasenotes/notes/fix-ansible-user-parameter-5a3af8248a4fb494.yaml [new file with mode: 0644]
templates/builder.pkr.hcl
templates/devstack-pre-pip-yoga.pkr.hcl
templates/devstack.pkr.hcl
templates/docker.pkr.hcl
templates/windows-builder.pkr.hcl

diff --git a/releasenotes/notes/fix-ansible-user-parameter-5a3af8248a4fb494.yaml b/releasenotes/notes/fix-ansible-user-parameter-5a3af8248a4fb494.yaml
new file mode 100644 (file)
index 0000000..9fcb397
--- /dev/null
@@ -0,0 +1,46 @@
+---
+fixes:
+  - |
+    Fix Ansible provisioner user parameter in OpenStack templates.
+
+    The Ansible provisioner in OpenStack templates (builder.pkr.hcl,
+    docker.pkr.hcl, devstack.pkr.hcl, devstack-pre-pip-yoga.pkr.hcl, and
+    windows-builder.pkr.hcl) was missing the ``user`` parameter, causing
+    Ansible to default to the wrong user account when connecting to
+    instances through SSH.
+
+    This resulted in SCP failures during the "Gathering Facts" task with
+    errors like:
+
+    .. code-block:: text
+
+       fatal: [default]: FAILED! => {}
+       MSG:
+       failed to transfer file to /home/runner/.ansible/tmp/...
+       scp: dest open '~runner/.ansible/tmp/...': No such file or directory
+
+    **Root Cause**: During the HCL2 conversion (commit 6e2fdc9), AWS
+    templates were created with ``user = "${var.ssh_user}"`` but OpenStack
+    templates were not. This was an oversight that went undetected until
+    Ansible provisioning was tested through bastion/jump hosts in CI/CD
+    environments.
+
+    **Resolution**: Added ``user = "${var.ssh_user}"`` parameter to the
+    Ansible provisioner block in all affected OpenStack templates. This
+    ensures Ansible uses the correct SSH user (ubuntu/centos/cloud-user)
+    as defined in the respective vars files.
+
+    **Backward Compatibility**: This change is fully backward compatible:
+
+    - The ``ssh_user`` variable already exists in all vars files
+    - AWS templates already use this pattern successfully
+    - No changes required to existing Jenkins jobs or workflows
+    - The fix aligns OpenStack templates with the existing AWS template pattern
+
+    Templates updated:
+
+    - templates/builder.pkr.hcl
+    - templates/docker.pkr.hcl
+    - templates/devstack.pkr.hcl
+    - templates/devstack-pre-pip-yoga.pkr.hcl
+    - templates/windows-builder.pkr.hcl
index f805d1b..a92b05c 100644 (file)
@@ -228,5 +228,6 @@ build {
     extra_arguments    = local.ssh_extra_args
     playbook_file      = "provision/local-builder.yaml"
     skip_version_check = true
+    user               = "${var.ssh_user}"
   }
 }
index abcbbc1..c3f72d0 100644 (file)
@@ -233,5 +233,6 @@ build {
     extra_arguments    = local.ssh_extra_args
     playbook_file      = "provision/devstack-pre-pip-centos.yaml"
     skip_version_check = true
+    user               = "${var.ssh_user}"
   }
 }
index 0fd8c88..0489ccc 100644 (file)
@@ -235,5 +235,6 @@ build {
     extra_arguments    = local.ssh_extra_args
     playbook_file      = "provision/devstack-centos.yaml"
     skip_version_check = true
+    user               = "${var.ssh_user}"
   }
 }
index bd3e8fa..359f329 100644 (file)
@@ -234,5 +234,6 @@ build {
     extra_arguments    = local.ssh_extra_args
     playbook_file      = "provision/local-docker.yaml"
     skip_version_check = true
+    user               = "${var.ssh_user}"
   }
 }
index 35d5a79..5f63d0e 100644 (file)
@@ -221,5 +221,6 @@ build {
     extra_arguments    = local.ssh_extra_args
     playbook_file   = "provision/local-windows-builder.yaml"
     skip_version_check = true
+    user               = "${var.ssh_user}"
   }
 }