# Local NIS server - Question about ypdomainname

**URL:** <https://forums.rockylinux.org/t/local-nis-server-question-about-ypdomainname/19368>\
**Category:** Rocky Linux Help & Support\
**Tags:** rocky-linux-8\
**Created:** [August 10, 2025, 4:52am UTC](https://forums.rockylinux.org/t/local-nis-server-question-about-ypdomainname/19368 "2025-08-10T04:52:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![microlinux](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/microlinux/32/1244_2.png) [@microlinux](https://forums.rockylinux.org/u/microlinux)\
**Post date:** [August 10, 2025, 4:52am UTC](https://forums.rockylinux.org/t/local-nis-server-question-about-ypdomainname/19368/1 "2025-08-10T04:52:00Z")

</div>

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:

> **[Serveur NIS sous Rocky Linux 8 – Le blog technique de Microlinux](https://blog.microlinux.fr/serveur-nis-rocky-linux-8/)**

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

```auto
# 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

---

<div class="post-metadata">

**Author:** ![jlehtone](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@jlehtone](https://forums.rockylinux.org/u/jlehtone)\
**Post date:** [August 10, 2025, 8:23am UTC](https://forums.rockylinux.org/t/local-nis-server-question-about-ypdomainname/19368/2 "2025-08-10T08:23:12Z")

</div>

`man ypdomainname` says:

> **domainname, nisdomainname, ypdomainname** will print the name of the system as returned by the _**[getdomainname](https://linux.die.net/man/2/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` ?

---

<div class="post-metadata">

**Author:** ![microlinux](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/microlinux/32/1244_2.png) [@microlinux](https://forums.rockylinux.org/u/microlinux)\
**Post date:** [August 10, 2025, 8:42am UTC](https://forums.rockylinux.org/t/local-nis-server-question-about-ypdomainname/19368/3 "2025-08-10T08:42:22Z")

</div>

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:

> **[Nicolas Kovacs / Ansible role rh\_nis\_server · GitLab](https://gitlab.com/kikinovak/rh_nis_server)**
>
> Install and configure NIS on a local server running a RHEL-based system.

---

<div class="post-metadata">

**Author:** ![jlehtone](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@jlehtone](https://forums.rockylinux.org/u/jlehtone)\
**Post date:** [August 11, 2025, 9:32am UTC](https://forums.rockylinux.org/t/local-nis-server-question-about-ypdomainname/19368/4 "2025-08-11T09:32:00Z")

</div>

> [@microlinux](#):
>
> will write this domain to `/proc/sys/kernel/domainname`

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?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/rockylinux/original/1X/91b7219eec10e30013422e4df76c1d898711a5d5.svg) [@system](https://forums.rockylinux.org/u/system)\
**Post date:** [October 10, 2025, 9:32am UTC](https://forums.rockylinux.org/t/local-nis-server-question-about-ypdomainname/19368/5 "2025-10-10T09:32:14Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
