Packer v1.8.5 takes almost three times the build time compared to v1.8.0

I’m looking to update the packer version we use to build images from v1.8.0 to v1.8.5.
However, the build takes almost three times as long using the amazon ebs builder. It is using the same base AMI and provisioners, the only difference is the packer build version. Other builders (e.g. openstack) take the same approximate time to build the image.

For example,
using v1.8.0 (so amazon plugin v1.0.8): Build 'amazon-ebs.aws_instance' finished after 10 minutes 37 seconds.
using v1.8.5 (using amazon plugin v1.1.6): Build 'amazon-ebs.aws_instance' finished after 28 minutes 55 seconds.

We use ansible to provision the image, and we’ve turned on the ansible.posix.profile_tasks callback to see where the time is spent.

For v1.8.0, almost all tasks took less than 1 second, often fractions of a second.
For v1.8.5, most tasks take at least 1 second, often more than 1 second.
So the increase in time is spread across the ansible provisioner tasks.

Any hints as to why the build takes so much more time?
Were there changes to the SSH communicator in packer or the amazon plugin that could cause this?

Hi Cofiem,

I made the same observation as you

Me it’s between 1.6.6 and 1.8.6, a yum update under centos who take 7 minutes under 1.6.6 take 26 minutes under 1.8.6.
how is it possible such a difference ?

Hello,

Did you find the reason ?

I haven’t worked out a cause for sure, but it looks like it might be related to ansible, see fix various Jinja plugin caching issues by nitzmahone · Pull Request #79781 · ansible/ansible · GitHub

Hi Cofiem,

Thanks to answer me first of all, but i did not understand well the issue .
How the problem is fixed ?
I am in ansible 2.15.4 and Python 3.9.17 and i 've still the problem

Regards
Mickaël

Hi Mickael,

It looks like the commit is not yet in a release / tag.

Hi Cofiem,

Ok it’s on the devel branch thanks again.

Regards
Mickaël

It looks like the fix for this issue is included in ansible v2.14.11 and v2.15.5. However, the fix introduced an error loading custom filters, so watch out for that if you’re using custom filters.