What is the recommended method to prepare Red Hat/CentOS 7 templates?

Solution 1:

What we think of as the initial setup is actually in three parts. The first two are:

  • Initial setup, which asks you to accept the license and create a user
  • Firstboot, which asks you to configure kdump and (on RHEL) set up your subscription

Both of these are now enabled via systemd; once complete they disable themselves.

So, all you should have to do is remove any local user(s) created during the first Initial Setup process and re-enable these services:

systemctl enable initial-setup-graphical.service
systemctl enable firstboot-graphical.service
> /etc/sysconfig/firstboot

and reboot.

I'm not entirely sure about the third part, which asks you for your language and to create a user account or to to join the machine to a domain. This, at least, will continue coming back until you actually complete the wizard. (So don't do that.)

It still may be a good idea to clean-up host keys and any hardware specific configuration. (Mac addresses in udev rules and interface configuration files.)