During kickstart, in template, where to create file before %packages?

I am running Foreman 1.16 and building some simple CentOS hosts. One of our requirements is that the service users added during kickstart are static. During our kickstart we add http, ntp and several others. Those packages create the user the fly with available ids. I’d like to be able to pre-configure some users before the %packages section is run to ensure that the users already exist and so we know for certain what user ids/group ids they will have.

The idea I’ve been floating is to do something like this placed into the “Kickstart default” template:

echo <%= snippet 'default_passwd' %> > /etc/passwd
echo <%= snippet 'default_group' %> > /etc/group
echo <%= snippet 'default_shadow' %> > /etc/shadow

But unfortunately I’ve not been able to figure out how to get this in there outside of %post which… at that point the packages have been installed and would not work as we need.

Any suggestions? Is this even possible?

Could you not attack this from the other end, and create the users/groups in %post and then install the packages in %post as well (using yum), instead of in %packages?

Thats a good suggestion. %pre seems to be way to early (gets stomped by filesystem creation?).

I was also looking at --enableldap but it seems that requires nss_ldap package which implies %packages already ran and again, to late.

I’ll un-string all our @macro package lists and see if I can just do something like
yum -y install $(cat file_name)
in %post AFTER I create the files I need.

Did you have any luck with this? I wanted to try copying a generic shadow file over but didn’t think that would work.

@ksully1721 No, we never got a working prototype.

The requirement for “service users” being in the host during kickstart was discarded when that management person was let go. We now use puppet (as I would recommend anyone else do) to manage users and life is much easier.