%end
%post
- # Create vagrant user and group, give them correct permissions
- groupadd vagrant
- useradd vagrant -g vagrant -G wheel
- echo "vagrant" | passwd --stdin vagrant
- echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/vagrant
+ # In the VM output, this is the "Running post-installation scripts" section.
+ # Unfortunately, it produces no output. The `yum update` step may give the
+ # appearance that the build is hung, as it's slow, uses little CPU and
+ # doesn't transfer much data during the package index building step.
# Update all packages
yum update -y
# Clear yum cache to save space
yum clean all
+
+ # Create vagrant user and group, give them correct permissions
+ # This needs to happen before Packer tries to SSH in and poweroff the VM,
+ # (at the end of the builder step), so it must be done here (in the
+ # builder step), not in an external script called by a Packer shell
+ # provisioner (after the builder step).
+ groupadd vagrant
+ useradd vagrant -g vagrant -G wheel
+ echo "vagrant" | passwd --stdin vagrant
+ echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/vagrant
%end