Local NIS server - Question about ypdomainname

Hi,

Our local school has been running RHEL clones since 2010 : CentOS 5, 6, and 7. Currently it’s a mix of Rocky Linux 8 and 9.

For central authentication we’ve always been using NIS (ypserv). I know it’s considered obsolete and has been removed from RHEL 9. But its bone-headed configuration has worked well these past 15 years.

I’m currently writing an Ansible playbook to automate NIS configuration on Rocky Linux 8. I’m mostly using the procedure described here:

One of the first steps consists in defining the NIS domain using the following command:

# ypdomainname scholae.lan

I’d like to make this idempotent in Ansible, so I wonder what this command does under the hood. What file(s) does it create and/or alter under the hood ?

Cheers,

Niki

man ypdomainname says:

domainname, nisdomainname, ypdomainname will print the name of the system as returned by the getdomainname(2) function. This is also known as the YP/NIS domain name of the system.

and getdomainname() says that it calls uname().

You could strace ypdomainname xxx and/or grep -r xxx /etc ?

I did some more digging, and it looks like ypdomainname example.lan will write this domain to /proc/sys/kernel/domainname.

I managed to write the whole rh_nis_server role, and so far it looks good:

Which is in RAM. Not stored to survive a reboot.
If the name is needed later, then it has to be set on boot with something?