Add Packer support for building Vagrant base boxes
[integration.git] / packaging / packer / centos_kickstart.cfg
index bb686771a7c8a0f6ef43727119a0cedbea88283c..96680644482fdcdd4c622984a8338ba662ce2591 100644 (file)
@@ -44,15 +44,24 @@ reboot
 %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