Skip to content
This repository was archived by the owner on Mar 8, 2023. It is now read-only.

Commit 2f2920b

Browse files
committed
Merge pull request #46 from echocat/develop
Backmerge Develop for release 1.7.0
2 parents 9479a10 + 0a47edd commit 2f2920b

36 files changed

+444
-125
lines changed

.gitignore

+49-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,51 @@
1-
spec/fixtures/modules/*
2-
spec/fixtures/manifests/*
3-
*swp
1+
*.gem
2+
*.rbc
3+
/.config
4+
/coverage/
5+
/InstalledFiles
6+
/pkg/
7+
/spec/reports/
8+
/test/tmp/
9+
/test/version_tmp/
10+
/tmp/
11+
12+
# Beaker/Vagrant
13+
.vagrant/
14+
15+
# Puppet Files
16+
pkg
17+
spec/fixtures
18+
.rspec_system
19+
.vagrant/
20+
21+
## Specific to RubyMotion:
22+
.dat*
23+
.repl_history
24+
build/
25+
26+
## Documentation cache and generated files:
27+
/.yardoc/
28+
/_yardoc/
29+
/doc/
30+
/rdoc/
31+
32+
## Environment normalisation:
33+
/.bundle/
34+
/lib/bundler/man/
435

5-
.DS_Store
636
Gemfile.lock
37+
.ruby-version
38+
.ruby-gemset
39+
40+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
41+
.rvmrc
42+
43+
# idea
44+
./idea
45+
46+
# geppetto/eclipse
47+
.project
48+
49+
# others
50+
*swp
51+
.DS_Store

CHANGELOG.md

+13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
## 2015-10-16 - 1.7.0 (Feature/Bugfixe release)
2+
3+
#### Features:
4+
5+
- (cf2d4f5) #37 #41 add optinal parameter `exports` for class server
6+
- (70ea022) #42 add the ability to manage the services. See `service_manage`
7+
- (1117238) #43 speed up puppet parser validate tests
8+
9+
#### Bugfixes:
10+
11+
- (426ad8f) #27 #44 add special config for ubuntu to fix service name bug for idmapd
12+
- (f84c342) #45 ensure order of client class dependencies
13+
114
## 2015-09-29 - 1.6.0 (Feature/Bugfixe release)
215

316
#### Features:

DEVELOP.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Tests are written with [rspec-puppet](http://rspec-puppet.com/). CI is covered b
2222

2323
To run all tests:
2424

25-
rake spec
25+
bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--color --format documentation'
2626

2727
Branching
2828
---------

README.md

+18
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,11 @@ Set up NFS server and exports. NFSv3 and NFSv4 supported.
333333

334334
**Parameters within `nfs::server`:**
335335

336+
#####`service_manage` (true)
337+
338+
Should this class manage the services behind nfs? Set this to false
339+
if you are managing the service in another way (e.g. pacemaker).
340+
336341
#####`nfs_v4` (optional)
337342

338343
NFSv4 support. Will set up automatic bind mounts to export root.
@@ -347,6 +352,19 @@ Export root, where we bind mount shares, default /export
347352
Domain setting for idmapd, must be the same across server
348353
and clients. Default is to use $domain fact.
349354

355+
#####`exports` (optional)
356+
357+
If set, this attribute will be used to
358+
construct nfs::server::export resources. You can use you ENC or hiera to
359+
provide the hash of nfs::server::export resources definitions:
360+
361+
```hiera
362+
nfs::server::exports:
363+
/mnt/something:
364+
ensure: mounted
365+
clients: '*(fsid=0,ro,insecure,async,all_squash,no_subtree_check,mountpoint=/mnt/something)'
366+
```
367+
350368
#####Examples
351369

352370
```puppet

Rakefile

+1-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]
1313

1414
desc "Validate manifests, templates, and ruby files in lib."
1515
task :validate do
16-
Dir['manifests/**/*.pp'].each do |manifest|
17-
sh "puppet parser validate --noop #{manifest}"
18-
end
16+
sh "puppet parser validate --noop #{Dir['manifests/**/*.pp'].join(" ")}"
1917
Dir['lib/**/*.rb'].each do |lib_file|
2018
sh "ruby -c #{lib_file}"
2119
end

manifests/client.pp

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
$nfs_v4_idmap_domain = $::nfs::params::nfs_v4_idmap_domain
3535
) inherits nfs::params {
3636

37+
validate_bool($nfs_v4)
38+
3739
# ensure dependencies for mount
3840

3941
Class["::nfs::client::${::nfs::params::osfamily}::install"] ->

manifests/client/debian.pp

+7-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@
33
$nfs_v4_idmap_domain = undef
44
) {
55

6-
include nfs::client::debian::install,
7-
nfs::client::debian::configure,
8-
nfs::client::debian::service
6+
include ::nfs::client::debian::install
7+
include ::nfs::client::debian::configure
8+
include ::nfs::client::debian::service
9+
10+
Class['::nfs::client::debian::install']->
11+
Class['::nfs::client::debian::configure']->
12+
Class['::nfs::client::debian::service']
913

1014
}

manifests/client/debian/configure.pp

-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
class nfs::client::debian::configure {
2-
Augeas{
3-
require => Class['nfs::client::debian::install']
4-
}
52

63
if $nfs::client::debian::nfs_v4 {
74
augeas {

manifests/client/debian/install.pp

-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
ensure => installed,
55
}
66

7-
Package['rpcbind'] -> Service['rpcbind']
8-
9-
107
package { ['nfs-common', 'nfs4-acl-tools']:
118
ensure => installed,
129
}

manifests/client/debian/service.pp

-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
class nfs::client::debian::service {
2-
Service {
3-
require => Class['nfs::client::debian::configure']
4-
}
52

63
service { 'rpcbind':
74
ensure => running,

manifests/client/gentoo.pp

+8-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@
33
$nfs_v4_idmap_domain = undef
44
) {
55

6-
include nfs::client::gentoo::install,
7-
nfs::client::gentoo::configure,
8-
nfs::client::gentoo::service
6+
include ::nfs::client::gentoo::install
7+
include ::nfs::client::gentoo::configure
8+
include ::nfs::client::gentoo::service
9+
10+
Class['::nfs::client::gentoo::install']->
11+
Class['::nfs::client::gentoo::configure']->
12+
Class['::nfs::client::gentoo::service']
13+
914

1015
}

manifests/client/redhat.pp

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
# Shamefully stolen from https://github.com/frimik/puppet-nfs
2-
# refactored a bit
3-
41
class nfs::client::redhat (
52
$nfs_v4 = false,
63
$nfs_v4_idmap_domain = undef
74
) inherits nfs::client::redhat::params {
85

9-
include nfs::client::redhat::install,
10-
nfs::client::redhat::configure,
11-
nfs::client::redhat::service
6+
include ::nfs::client::redhat::install
7+
include ::nfs::client::redhat::configure
8+
include ::nfs::client::redhat::service
9+
10+
Class['::nfs::client::redhat::install']->
11+
Class['::nfs::client::redhat::configure']->
12+
Class['::nfs::client::redhat::service']
1213

1314
}

manifests/client/redhat/configure.pp

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
class nfs::client::redhat::configure {
55

6-
76
if $nfs::client::redhat::nfs_v4 {
87
augeas {
98
'/etc/idmapd.conf':

manifests/client/redhat/service.pp

-5
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33

44
class nfs::client::redhat::service {
55

6-
Service {
7-
require => Class['nfs::client::redhat::configure']
8-
}
9-
106
# lint:ignore:selector_inside_resource would not add much to readability
117

128
service {'nfslock':
@@ -37,7 +33,6 @@
3733
}
3834
}
3935

40-
4136
if $::nfs::client::redhat::params::osmajor == 6 or $::nfs::client::redhat::params::osmajor == 7 {
4237
service {'rpcbind':
4338
ensure => running,

manifests/client/ubuntu.pp

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class nfs::client::ubuntu (
2+
$nfs_v4 = false,
3+
$nfs_v4_idmap_domain = undef
4+
) {
5+
6+
include ::nfs::client::ubuntu::install
7+
include ::nfs::client::ubuntu::configure
8+
include ::nfs::client::ubuntu::service
9+
10+
Class['::nfs::client::ubuntu::install']->
11+
Class['::nfs::client::ubuntu::configure']->
12+
Class['::nfs::client::ubuntu::service']
13+
14+
}

manifests/client/ubuntu/configure.pp

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
class nfs::client::ubuntu::configure {
2+
3+
if $nfs::client::ubuntu::nfs_v4 {
4+
augeas {
5+
'/etc/default/nfs-common':
6+
context => '/files/etc/default/nfs-common',
7+
changes => [ 'set NEED_IDMAPD yes', ];
8+
'/etc/idmapd.conf':
9+
context => '/files/etc/idmapd.conf/General',
10+
lens => 'Puppet.lns',
11+
incl => '/etc/idmapd.conf',
12+
changes => ["set Domain ${nfs::client::ubuntu::nfs_v4_idmap_domain}"],
13+
}
14+
}
15+
16+
}

manifests/client/ubuntu/install.pp

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class nfs::client::ubuntu::install {
2+
3+
package { 'rpcbind':
4+
ensure => installed,
5+
}
6+
7+
package { ['nfs-common', 'nfs4-acl-tools']:
8+
ensure => installed,
9+
}
10+
11+
}

manifests/client/ubuntu/service.pp

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class nfs::client::ubuntu::service {
2+
3+
service { 'rpcbind':
4+
ensure => running,
5+
enable => true,
6+
hasstatus => false,
7+
}
8+
9+
if $nfs::client::ubuntu::nfs_v4 {
10+
service { 'idmapd':
11+
ensure => running,
12+
subscribe => Augeas['/etc/idmapd.conf', '/etc/default/nfs-common'],
13+
}
14+
} else {
15+
service { 'idmapd': ensure => stopped, }
16+
}
17+
}

manifests/params.pp

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
# Somehow the ::osfamily fact doesnt exist on some systems
1010

1111
case $::operatingsystem {
12-
'centos', 'redhat', 'scientific', 'fedora', 'SLC', 'OracleLinux', 'Amazon' : { $osfamily = 'redhat' }
13-
'debian', 'Ubuntu' : { $osfamily = 'debian' }
14-
'windows' : { fail('fail!11') }
15-
'darwin' : { $osfamily = 'darwin' }
16-
'gentoo' : { $osfamily = 'gentoo' }
17-
default : { fail("OS: ${::operatingsystem} not supported") }
12+
'CentOS', 'RedHat', 'scientific', 'Fedora', 'SLC', 'OracleLinux', 'Amazon' : { $osfamily = 'redhat' }
13+
'Debian' : { $osfamily = 'debian' }
14+
'Ubuntu' : { $osfamily = 'ubuntu' }
15+
'darwin' : { $osfamily = 'darwin' }
16+
'gentoo' : { $osfamily = 'gentoo' }
17+
default : { fail("OS: ${::operatingsystem} not supported") }
1818
}
1919
}

manifests/server.pp

+24-6
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@
1313
# Export root, where we bind mount shares, default /export
1414
#
1515
# [nfs_v4_idmap_domain]
16-
# Domain setting for idmapd, must be the same across server
17-
# and clients.
18-
# Default is to use $domain fact.
16+
# Domain setting for idmapd, must be the same across server
17+
# and clients.
18+
# Default is to use $domain fact.
19+
#
20+
# [service_manage]
21+
# Should this class manage the services behind nfs? Set this to false
22+
# if you are managing the service in another way (e.g. pacemaker).
1923
#
2024
# === Examples
2125
#
@@ -29,11 +33,13 @@
2933
# }
3034

3135
class nfs::server (
32-
$nfs_v4 = $nfs::params::nfs_v4,
36+
$nfs_v4 = $nfs::params::nfs_v4,
3337
$nfs_v4_export_root = $nfs::params::nfs_v4_export_root,
3438
$nfs_v4_export_root_clients = $nfs::params::nfs_v4_export_root_clients,
3539
$nfs_v4_idmap_domain = $nfs::params::nfs_v4_idmap_domain,
3640
#
41+
$service_manage = true,
42+
#
3743
$nfs_v4_root_export_ensure = 'mounted',
3844
$nfs_v4_root_export_mount = undef,
3945
$nfs_v4_root_export_remounts = false,
@@ -42,17 +48,29 @@
4248
$nfs_v4_root_export_bindmount = undef,
4349
$nfs_v4_root_export_tag = undef,
4450
#
45-
$mountd_port = undef,
46-
$mountd_threads = 1
51+
$mountd_port = undef,
52+
$mountd_threads = 1,
53+
#
54+
$exports = undef,
4755
) inherits nfs::params {
4856

57+
validate_bool($nfs_v4)
58+
validate_bool($service_manage)
59+
validate_bool($nfs_v4_root_export_remounts)
60+
validate_bool($nfs_v4_root_export_atboot)
61+
4962
class { "nfs::server::${::nfs::params::osfamily}":
5063
nfs_v4 => $nfs_v4,
5164
nfs_v4_idmap_domain => $nfs_v4_idmap_domain,
5265
mountd_port => $mountd_port,
5366
mountd_threads => $mountd_threads,
67+
service_manage => $service_manage,
5468
}
5569

5670
include nfs::server::configure
5771

72+
if $exports {
73+
create_resources(nfs::server::export, $exports)
74+
}
75+
5876
}

manifests/server/darwin.pp

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
$nfs_v4 = false,
33
$nfs_v4_idmap_domain = undef,
44
$mountd_port = undef,
5-
$mountd_threads = 1
5+
$mountd_threads = 1,
6+
$service_manage = true,
67
) {
78
fail('NFS server is not supported on Darwin')
89
}

0 commit comments

Comments
 (0)