Skip to content

Commit

Permalink
Remove all class absolute name scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
coreone committed Oct 30, 2020
1 parent a39f19f commit a6270f1
Show file tree
Hide file tree
Showing 18 changed files with 167 additions and 167 deletions.
52 changes: 26 additions & 26 deletions README.md
Expand Up @@ -52,28 +52,28 @@ are known to work and used in the examples and tests in this module.
Bind a client to a YP domain using three YP servers:

```puppet
include ::portmap
include portmap
class { '::yp':
class { 'yp':
domain => 'example.com',
}
class { '::yp::bind':
class { 'yp::bind':
domain => 'example.com',
servers => ['192.0.2.1', '192.0.2.2', '192.0.2.3'],
}
Class['::portmap'] ~> Class['::yp::bind'] <~ Class['::yp']
Class['portmap'] ~> Class['yp::bind'] <~ Class['yp']
if $::osfamily == 'RedHat' {
class { '::nsswitch':
class { 'nsswitch':
passwd => ['files', 'nis', 'sss'],
shadow => ['files', 'nis', 'sss'],
group => ['files', 'nis', 'sss'],
hosts => ['files', 'nis', 'dns'],
netgroup => ['files', 'nis', 'sss'],
automount => ['files', 'nis'],
require => Class['::yp::bind'],
require => Class['yp::bind'],
}
pam { 'nis':
Expand All @@ -90,7 +90,7 @@ if $::osfamily == 'RedHat' {
'try_first_pass',
'use_authtok',
],
require => Class['::yp::bind'],
require => Class['yp::bind'],
}
}
```
Expand All @@ -100,29 +100,29 @@ if $::osfamily == 'RedHat' {
Create a standalone YP server:

```puppet
include ::portmap
include portmap
class { '::yp':
class { 'yp':
domain => 'example.com',
}
class { '::yp::serv':
class { 'yp::serv':
domain => 'example.com',
}
Class['::portmap'] ~> Class['::yp::serv'] <- Class['::yp']
Class['portmap'] ~> Class['yp::serv'] <- Class['yp']
```

Create a master YP server with two additional slaves:

```puppet
include ::portmap
include portmap
class { '::yp':
class { 'yp':
domain => 'example.com',
}
class { '::yp::serv':
class { 'yp::serv':
domain => 'example.com',
maps => [
'passwd.byname',
Expand All @@ -137,19 +137,19 @@ class { '::yp::serv':
],
}
Class['::portmap'] ~> Class['::yp::serv'] <- Class['::yp']
Class['portmap'] ~> Class['yp::serv'] <- Class['yp']
```

Create a slave YP server pointing at the above master YP server:

```puppet
include ::portmap
include portmap
class { '::yp':
class { 'yp':
domain => 'example.com',
}
class { '::yp::serv':
class { 'yp::serv':
domain => 'example.com',
maps => [
'passwd.byname',
Expand All @@ -161,21 +161,21 @@ class { '::yp::serv':
master => '192.0.2.1',
}
class { '::yp::bind':
class { 'yp::bind':
domain => 'example.com',
}
Class['::portmap'] ~> Class['::yp::serv'] <- Class['::yp']
Class['::yp::serv'] -> Class['::yp::bind'] <~ Class['::yp']
Class['portmap'] ~> Class['yp::serv'] <- Class['yp']
Class['yp::serv'] -> Class['yp::bind'] <~ Class['yp']
```

For OpenBSD only, set up `ypldap` to create YP maps from an LDAP server and
also bind to it. This is the equivalent to PAM/LDAP on Linux:

```puppet
include ::portmap
include portmap
class { '::yp::ldap':
class { 'yp::ldap':
domain => 'example.com',
directories => {
'dc=example,dc=com' => {
Expand All @@ -186,15 +186,15 @@ class { '::yp::ldap':
},
}
class { '::yp':
class { 'yp':
domain => 'example.com',
}
class { '::yp::bind':
class { 'yp::bind':
domain => 'example.com',
}
Class['::portmap'] ~> Class['::yp::ldap'] ~> Class['::yp::bind'] <~ Class['::yp']
Class['portmap'] ~> Class['yp::ldap'] ~> Class['yp::bind'] <~ Class['yp']
```

## Reference
Expand Down
36 changes: 18 additions & 18 deletions manifests/bind.pp
@@ -1,13 +1,13 @@
# Class for installing and managing `ypbind` daemon.
#
# @example Declaring the class
# include ::portmap
# include portmap
#
# class { '::yp':
# class { 'yp':
# domain => 'example.com',
# }
#
# class { '::yp::bind':
# class { 'yp::bind':
# domain => 'example.com',
# servers => [
# '192.0.2.1',
Expand All @@ -16,17 +16,17 @@
# ],
# }
#
# Class['::portmap'] ~> Class['::yp::bind'] <~ Class['::yp']
# Class['portmap'] ~> Class['yp::bind'] <~ Class['yp']
#
# if $::osfamily == 'RedHat' {
# class { '::nsswitch':
# class { 'nsswitch':
# passwd => ['files', 'nis', 'sss'],
# shadow => ['files', 'nis', 'sss'],
# group => ['files', 'nis', 'sss'],
# hosts => ['files', 'nis', 'dns'],
# netgroup => ['files', 'nis', 'sss'],
# automount => ['files', 'nis'],
# require => Class['::yp::bind'],
# require => Class['yp::bind'],
# }
#
# pam { 'nis':
Expand All @@ -43,7 +43,7 @@
# 'try_first_pass',
# 'use_authtok',
# ],
# require => Class['::yp::bind'],
# require => Class['yp::bind'],
# }
# }
#
Expand All @@ -56,20 +56,20 @@
# @param service_name The name of the service managing `ypbind`.
#
# @see puppet_classes::yp ::yp
# @see puppet_classes::yp::serv ::yp::serv
# @see puppet_classes::yp::ldap ::yp::ldap
# @see puppet_classes::yp::serv yp::serv
# @see puppet_classes::yp::ldap yp::ldap
class yp::bind (
String $domain,
Optional[Array[IP::Address::NoSubnet, 1]] $servers = undef,
Boolean $manage_package = $::yp::params::bind_manage_package,
Optional[String] $package_name = $::yp::params::bind_package_name,
String $service_name = $::yp::params::bind_service_name,
) inherits ::yp::params {
Boolean $manage_package = $yp::params::bind_manage_package,
Optional[String] $package_name = $yp::params::bind_package_name,
String $service_name = $yp::params::bind_service_name,
) inherits yp::params {

contain ::yp::bind::install
contain ::yp::bind::config
contain ::yp::bind::service
contain yp::bind::install
contain yp::bind::config
contain yp::bind::service

Class['::yp::bind::install'] -> Class['::yp::bind::config']
~> Class['::yp::bind::service']
Class['yp::bind::install'] -> Class['yp::bind::config']
~> Class['yp::bind::service']
}
4 changes: 2 additions & 2 deletions manifests/bind/config.pp
@@ -1,8 +1,8 @@
# @!visibility private
class yp::bind::config {

$domain = $::yp::bind::domain
$servers = $::yp::bind::servers
$domain = $yp::bind::domain
$servers = $yp::bind::servers

case $::osfamily {
'OpenBSD': {
Expand Down
4 changes: 2 additions & 2 deletions manifests/bind/install.pp
@@ -1,8 +1,8 @@
# @!visibility private
class yp::bind::install {

if $::yp::bind::manage_package {
package { $::yp::bind::package_name:
if $yp::bind::manage_package {
package { $yp::bind::package_name:
ensure => present,
}
}
Expand Down
2 changes: 1 addition & 1 deletion manifests/bind/service.pp
@@ -1,7 +1,7 @@
# @!visibility private
class yp::bind::service {

service { $::yp::bind::service_name:
service { $yp::bind::service_name:
ensure => running,
enable => true,
hasstatus => true,
Expand Down
4 changes: 2 additions & 2 deletions manifests/config.pp
@@ -1,7 +1,7 @@
# @!visibility private
class yp::config {

$domain = $::yp::domain
$domain = $yp::domain

case $::osfamily {
'OpenBSD': {
Expand Down Expand Up @@ -32,7 +32,7 @@
unless => "domainname | grep -q ^${domain}\$",
}

file { $::yp::yp_dir:
file { $yp::yp_dir:
ensure => directory,
owner => 0,
group => 0,
Expand Down
14 changes: 7 additions & 7 deletions manifests/init.pp
@@ -1,20 +1,20 @@
# Class for configuring the YP/NIS domain.
#
# @example Declaring the class
# class { '::yp':
# class { 'yp':
# domain => 'example.com',
# }
#
# @param domain The YP/NIS domain.
# @param yp_dir The base YP directory, usually `/var/yp`.
#
# @see puppet_classes::yp::bind ::yp::bind
# @see puppet_classes::yp::serv ::yp::serv
# @see puppet_classes::yp::ldap ::yp::ldap
# @see puppet_classes::yp::bind yp::bind
# @see puppet_classes::yp::serv yp::serv
# @see puppet_classes::yp::ldap yp::ldap
class yp (
String $domain,
Stdlib::Absolutepath $yp_dir = $::yp::params::yp_dir,
) inherits ::yp::params {
Stdlib::Absolutepath $yp_dir = $yp::params::yp_dir,
) inherits yp::params {

contain ::yp::config
contain yp::config
}
32 changes: 16 additions & 16 deletions manifests/ldap.pp
Expand Up @@ -3,9 +3,9 @@
# This is for OpenBSD only and is the equivalent of PAM/LDAP on Linux.
#
# @example Declaring the class
# include ::portmap
# include portmap
#
# class { '::yp::ldap':
# class { 'yp::ldap':
# domain => 'example.com',
# directories => {
# 'dc=example,dc=com' => {
Expand All @@ -16,15 +16,15 @@
# },
# }
#
# class { '::yp':
# class { 'yp':
# domain => 'example.com',
# }
#
# class { '::yp::bind':
# class { 'yp::bind':
# domain => 'example.com',
# }
#
# Class['::portmap'] ~> Class['::yp::ldap'] ~> Class['::yp::bind'] <~ Class['::yp']
# Class['portmap'] ~> Class['yp::ldap'] ~> Class['yp::bind'] <~ Class['yp']
#
# @param domain The YP/NIS domain for which to provide maps fetched from LDAP.
# @param conf_file The configuration file, usually `/etc/ypldap.conf`.
Expand All @@ -35,29 +35,29 @@
# @param tls_cacert_file
#
# @see puppet_classes::yp ::yp
# @see puppet_classes::yp::bind ::yp::bind
# @see puppet_classes::yp::serv ::yp::serv
# @see puppet_defined_types::yp::ldap::directory ::yp::ldap::directory
# @see puppet_classes::yp::bind yp::bind
# @see puppet_classes::yp::serv yp::serv
# @see puppet_defined_types::yp::ldap::directory yp::ldap::directory
class yp::ldap (
String $domain,
Hash[String, Hash[String, Any]] $directories = {},
Stdlib::Absolutepath $conf_file = $::yp::params::ldap_conf_file,
Stdlib::Absolutepath $conf_file = $yp::params::ldap_conf_file,
Integer[1] $interval = 60,
Array[String, 1] $maps = $::yp::params::ldap_maps,
String $service_name = $::yp::params::ldap_service_name,
Array[String, 1] $maps = $yp::params::ldap_maps,
String $service_name = $yp::params::ldap_service_name,
Optional[Stdlib::Absolutepath] $tls_cacert_file = undef,
) inherits ::yp::params {
) inherits yp::params {

if $::osfamily != 'OpenBSD' {
fail("The yp::ldap class is not supported on ${::osfamily} based systems.")
}

if defined(Class['::yp::serv']) {
if defined(Class['yp::serv']) {
fail('yp::serv and yp::ldap are mutually exclusive.')
}

contain ::yp::ldap::config
contain ::yp::ldap::service
contain yp::ldap::config
contain yp::ldap::service

Class['::yp::ldap::config'] ~> Class['::yp::ldap::service']
Class['yp::ldap::config'] ~> Class['yp::ldap::service']
}

0 comments on commit a6270f1

Please sign in to comment.