I have tried to exemplify quite a few usual features and functionalities.
The last useful example I have developed was about NIS & logins.
This time I intend to provide an example dealing with new hosts.
It's clearly true that hosts are better managed with DNS services.
Anyway it's instructive to know how to do it in NIS services as well.
For brevity let's take all the assumptions presented in NIS & logins.
Fortunately, the task is much simpler than with accounts (logins & roles).
I'll update a couple of NIS maps and perform a rebuild on the NIS master.
For the sake of this post, I'll add 2 new hosts.
They will be DNS servers, object of a later post about DNS services.
I intend no special relationship between NIS services and DNS services.
The new hosts will be:
- dns-1.business.corp
- dns-2.business.corp
If the NIS master is an immutable zones then reboot it in R/W mode.
Next proceed to update the hosts map source.
nis-1# cd /var/nis
nis-1# egrep -i 'dns' hosts
# DNS servers
192.168.0.84 dns-1.business.corp dns-1
192.168.0.87 dns-2.business.corp dns-2
Probably it will make sense to update at least some NIS netgroups. In this case no other updates seems necessary, but depending on the role of the host others may be necessary, of course. A more complex example would be the case of new NFS severs.
Let's say I already have a servers NIS netgroup.
nis-1# ypmatch -k servers netgroup
servers: (server-1a,-,business.corp) (server-1b,-,business.corp) ...
I'll create another NIS netgroup called dns-servers.
I won't repeat their names in the servers NIS netgroup.
I'll just append dns-servers to servers.
nis-1# cat netgroup
dns-servers \
(dns-1,-,business.corp) (dns-2,-,business.corp)
servers \
(server-1a,-,business.corp) (server-1b,-,business.corp) ... \
dns-servers
...
Note that the order of definition within /var/nis/netgroup is unimportant.
Furthermore, note that it's possible to mix triples with other netgroups.
Now I double-check every update so far.
When ready I proceed to rebuilding the NIS maps.
nis-1# cd /var/yp
nis-1# make
updated netid
pushed netid
updated netgroup
pushed netgroup
updated hosts
pushed hosts
updated ipnodes
pushed ipnodes
As everything seems fine, I proceed to the verifications:
nis-1# ypmatch -k dns-servers netgroup
dns-servers: (dns-1,-,business.corp) (dns-2,-,business.corp)
nis-1# ypmatch -k servers netgroup
servers: (server-1a,-,business.corp) ... dns-servers
Now that everything is fine I'm ready to reenter the immutable state.
This is simply accomplished by an ordered reboot.
From withing the non-global zone:
nis-1# init 6
From the global zone:
gz# zoneadm -z nis-1 shutdown -r
NOTE
It's important to note that during this processes there were no disruption of service to clients as all NIS clients should have been associated only to NIS slave servers.