vnode.ypclient
Ansible Role: ypclient
This role sets up and configures the YP/NIS client used in OpenBSD and some other BSD operating systems. Right now, it only supports OpenBSD, but support for FreeBSD and NetBSD will be added soon.
When necessary, this role refers to system documentation, like the yp(8)
manual page.
Requirements
Usage
No extra roles or modules are needed to use this role.
Testing & Development
For testing and development, you'll need:
- Role vnode.ypserver
- Vagrant (works with either VirtualBox or VMWare)
- VagrantCloud (specifically, the
generic/openbsd6
box)
Role Variables
Below are the available variables, including their default values (check defaults/main.yml
). All of these should be used. If any are missing, please report it on GitHub.
Required Variables
These variables must be set when using the role.
ypclient_domain: ""
Required: This should have a valid NIS domain name. It’s the name of the NIS domain you want to set up.
ypclient_servers: []
Required: List of NIS servers for this domain.
ypclient_serverinfo: {}
Required: This can be empty if the NIS servers can be found in DNS or /etc/hosts
.
If it has entries, this dictionary should list the IPv4 and/or IPv6 addresses for the servers in the domain. The role will update /etc/hosts
accordingly. If servers can't be reached, the NIS code will hang. For more information, see yp(8)
.
Example showing addresses for the master
and slave
servers:
ypserver_serverinfo:
master:
- "192.0.2.1"
- "2001:db8::111:1"
slave:
- "192.0.2.2"
- "2001:db8::111:2"
Optional Variables
ypclient_usedns: true
Indicates if YP/NIS can use DNS for hostname lookups. It’s recommended to keep this true
. If set to false
, ensure that ypclient_serverinfo
and/or ypclient_set_hosts
are properly set so that your NIS servers can be resolved.
ypclient_lookup_maps:
- name: 'passwd'
file: '/etc/master.passwd'
pattern: '+:*::::::::'
validate: 'pwd_mkdb -c %s'
notify: "regen master.passwd"
mode: '0600'
owner: 'root'
group: 'wheel'
- name: 'group'
file: '/etc/group'
pattern: '+:*::'
mode: '0644'
owner: 'root'
group: 'wheel'
This list shows which lookup maps to use and which files to edit, along with the pattern. Specifying validation and handlers is optional. The specified maps should also exist on the NIS servers. For more supported maps, check out Makefile.yp(8)
.
Variables for Multiple YP/NIS Domains
This variable allows you to host multiple NIS domains on one server. This wasn't the original aim, so if you run into problems, please file an issue on GitHub.
ypclient_set_domainname: true
It’s best to keep this true
for the main domain. Set to false
if you want another domain to be the default.
Additional Settings
These variables aren't needed every time the role is used, and their defaults should work fine.
ypclient_set_hosts: false
If set to true
, the role will add IP details for the NIS servers to the /etc/hosts
file. This is mainly useful when DNS is not used for lookups (ypclient_usedns
is false
). Note that this requires IP info for each NIS server from the ypclient_serverinfo
variable.
Internal Variables
These variables are for internal use within the role and should not be changed by users. Modifying them can have undesired effects.
Dependencies
None.
Example Playbook
Here’s an example to create a simple YP/NIS client that connects to the hosts in the ypservers
group. The domain is called legacy
.
---
- hosts: ypclients
roles:
- role: vnode.ypclient
vars:
ypclient_ypdomain: legacy
ypclient_servers: "{{ groups['ypservers'] }}"
License
MIT
Author Information
This role was created in 2020 by Rogier Krieger.