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

Commit

Permalink
Merge pull request #46 from echocat/develop
Browse files Browse the repository at this point in the history
Backmerge Develop for release 1.7.0
  • Loading branch information
dwerder committed Oct 16, 2015
2 parents 9479a10 + 0a47edd commit 2f2920b
Show file tree
Hide file tree
Showing 36 changed files with 444 additions and 125 deletions.
53 changes: 49 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,51 @@
spec/fixtures/modules/*
spec/fixtures/manifests/*
*swp
*.gem
*.rbc
/.config
/coverage/
/InstalledFiles
/pkg/
/spec/reports/
/test/tmp/
/test/version_tmp/
/tmp/

# Beaker/Vagrant
.vagrant/

# Puppet Files
pkg
spec/fixtures
.rspec_system
.vagrant/

## Specific to RubyMotion:
.dat*
.repl_history
build/

## Documentation cache and generated files:
/.yardoc/
/_yardoc/
/doc/
/rdoc/

## Environment normalisation:
/.bundle/
/lib/bundler/man/

.DS_Store
Gemfile.lock
.ruby-version
.ruby-gemset

# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc

# idea
./idea

# geppetto/eclipse
.project

# others
*swp
.DS_Store
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## 2015-10-16 - 1.7.0 (Feature/Bugfixe release)

#### Features:

- (cf2d4f5) #37 #41 add optinal parameter `exports` for class server
- (70ea022) #42 add the ability to manage the services. See `service_manage`
- (1117238) #43 speed up puppet parser validate tests

#### Bugfixes:

- (426ad8f) #27 #44 add special config for ubuntu to fix service name bug for idmapd
- (f84c342) #45 ensure order of client class dependencies

## 2015-09-29 - 1.6.0 (Feature/Bugfixe release)

#### Features:
Expand Down
2 changes: 1 addition & 1 deletion DEVELOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Tests are written with [rspec-puppet](http://rspec-puppet.com/). CI is covered b

To run all tests:

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

Branching
---------
Expand Down
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,11 @@ Set up NFS server and exports. NFSv3 and NFSv4 supported.

**Parameters within `nfs::server`:**

#####`service_manage` (true)

Should this class manage the services behind nfs? Set this to false
if you are managing the service in another way (e.g. pacemaker).

#####`nfs_v4` (optional)

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

#####`exports` (optional)

If set, this attribute will be used to
construct nfs::server::export resources. You can use you ENC or hiera to
provide the hash of nfs::server::export resources definitions:

```hiera
nfs::server::exports:
/mnt/something:
ensure: mounted
clients: '*(fsid=0,ro,insecure,async,all_squash,no_subtree_check,mountpoint=/mnt/something)'
```

#####Examples

```puppet
Expand Down
4 changes: 1 addition & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]

desc "Validate manifests, templates, and ruby files in lib."
task :validate do
Dir['manifests/**/*.pp'].each do |manifest|
sh "puppet parser validate --noop #{manifest}"
end
sh "puppet parser validate --noop #{Dir['manifests/**/*.pp'].join(" ")}"
Dir['lib/**/*.rb'].each do |lib_file|
sh "ruby -c #{lib_file}"
end
Expand Down
2 changes: 2 additions & 0 deletions manifests/client.pp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
$nfs_v4_idmap_domain = $::nfs::params::nfs_v4_idmap_domain
) inherits nfs::params {

validate_bool($nfs_v4)

# ensure dependencies for mount

Class["::nfs::client::${::nfs::params::osfamily}::install"] ->
Expand Down
10 changes: 7 additions & 3 deletions manifests/client/debian.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
$nfs_v4_idmap_domain = undef
) {

include nfs::client::debian::install,
nfs::client::debian::configure,
nfs::client::debian::service
include ::nfs::client::debian::install
include ::nfs::client::debian::configure
include ::nfs::client::debian::service

Class['::nfs::client::debian::install']->
Class['::nfs::client::debian::configure']->
Class['::nfs::client::debian::service']

}
3 changes: 0 additions & 3 deletions manifests/client/debian/configure.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
class nfs::client::debian::configure {
Augeas{
require => Class['nfs::client::debian::install']
}

if $nfs::client::debian::nfs_v4 {
augeas {
Expand Down
3 changes: 0 additions & 3 deletions manifests/client/debian/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
ensure => installed,
}

Package['rpcbind'] -> Service['rpcbind']


package { ['nfs-common', 'nfs4-acl-tools']:
ensure => installed,
}
Expand Down
3 changes: 0 additions & 3 deletions manifests/client/debian/service.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
class nfs::client::debian::service {
Service {
require => Class['nfs::client::debian::configure']
}

service { 'rpcbind':
ensure => running,
Expand Down
11 changes: 8 additions & 3 deletions manifests/client/gentoo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@
$nfs_v4_idmap_domain = undef
) {

include nfs::client::gentoo::install,
nfs::client::gentoo::configure,
nfs::client::gentoo::service
include ::nfs::client::gentoo::install
include ::nfs::client::gentoo::configure
include ::nfs::client::gentoo::service

Class['::nfs::client::gentoo::install']->
Class['::nfs::client::gentoo::configure']->
Class['::nfs::client::gentoo::service']


}
13 changes: 7 additions & 6 deletions manifests/client/redhat.pp
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Shamefully stolen from https://github.com/frimik/puppet-nfs
# refactored a bit

class nfs::client::redhat (
$nfs_v4 = false,
$nfs_v4_idmap_domain = undef
) inherits nfs::client::redhat::params {

include nfs::client::redhat::install,
nfs::client::redhat::configure,
nfs::client::redhat::service
include ::nfs::client::redhat::install
include ::nfs::client::redhat::configure
include ::nfs::client::redhat::service

Class['::nfs::client::redhat::install']->
Class['::nfs::client::redhat::configure']->
Class['::nfs::client::redhat::service']

}
1 change: 0 additions & 1 deletion manifests/client/redhat/configure.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

class nfs::client::redhat::configure {


if $nfs::client::redhat::nfs_v4 {
augeas {
'/etc/idmapd.conf':
Expand Down
5 changes: 0 additions & 5 deletions manifests/client/redhat/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@

class nfs::client::redhat::service {

Service {
require => Class['nfs::client::redhat::configure']
}

# lint:ignore:selector_inside_resource would not add much to readability

service {'nfslock':
Expand Down Expand Up @@ -37,7 +33,6 @@
}
}


if $::nfs::client::redhat::params::osmajor == 6 or $::nfs::client::redhat::params::osmajor == 7 {
service {'rpcbind':
ensure => running,
Expand Down
14 changes: 14 additions & 0 deletions manifests/client/ubuntu.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class nfs::client::ubuntu (
$nfs_v4 = false,
$nfs_v4_idmap_domain = undef
) {

include ::nfs::client::ubuntu::install
include ::nfs::client::ubuntu::configure
include ::nfs::client::ubuntu::service

Class['::nfs::client::ubuntu::install']->
Class['::nfs::client::ubuntu::configure']->
Class['::nfs::client::ubuntu::service']

}
16 changes: 16 additions & 0 deletions manifests/client/ubuntu/configure.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class nfs::client::ubuntu::configure {

if $nfs::client::ubuntu::nfs_v4 {
augeas {
'/etc/default/nfs-common':
context => '/files/etc/default/nfs-common',
changes => [ 'set NEED_IDMAPD yes', ];
'/etc/idmapd.conf':
context => '/files/etc/idmapd.conf/General',
lens => 'Puppet.lns',
incl => '/etc/idmapd.conf',
changes => ["set Domain ${nfs::client::ubuntu::nfs_v4_idmap_domain}"],
}
}

}
11 changes: 11 additions & 0 deletions manifests/client/ubuntu/install.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class nfs::client::ubuntu::install {

package { 'rpcbind':
ensure => installed,
}

package { ['nfs-common', 'nfs4-acl-tools']:
ensure => installed,
}

}
17 changes: 17 additions & 0 deletions manifests/client/ubuntu/service.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class nfs::client::ubuntu::service {

service { 'rpcbind':
ensure => running,
enable => true,
hasstatus => false,
}

if $nfs::client::ubuntu::nfs_v4 {
service { 'idmapd':
ensure => running,
subscribe => Augeas['/etc/idmapd.conf', '/etc/default/nfs-common'],
}
} else {
service { 'idmapd': ensure => stopped, }
}
}
12 changes: 6 additions & 6 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
# Somehow the ::osfamily fact doesnt exist on some systems

case $::operatingsystem {
'centos', 'redhat', 'scientific', 'fedora', 'SLC', 'OracleLinux', 'Amazon' : { $osfamily = 'redhat' }
'debian', 'Ubuntu' : { $osfamily = 'debian' }
'windows' : { fail('fail!11') }
'darwin' : { $osfamily = 'darwin' }
'gentoo' : { $osfamily = 'gentoo' }
default : { fail("OS: ${::operatingsystem} not supported") }
'CentOS', 'RedHat', 'scientific', 'Fedora', 'SLC', 'OracleLinux', 'Amazon' : { $osfamily = 'redhat' }
'Debian' : { $osfamily = 'debian' }
'Ubuntu' : { $osfamily = 'ubuntu' }
'darwin' : { $osfamily = 'darwin' }
'gentoo' : { $osfamily = 'gentoo' }
default : { fail("OS: ${::operatingsystem} not supported") }
}
}
30 changes: 24 additions & 6 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@
# Export root, where we bind mount shares, default /export
#
# [nfs_v4_idmap_domain]
# Domain setting for idmapd, must be the same across server
# and clients.
# Default is to use $domain fact.
# Domain setting for idmapd, must be the same across server
# and clients.
# Default is to use $domain fact.
#
# [service_manage]
# Should this class manage the services behind nfs? Set this to false
# if you are managing the service in another way (e.g. pacemaker).
#
# === Examples
#
Expand All @@ -29,11 +33,13 @@
# }

class nfs::server (
$nfs_v4 = $nfs::params::nfs_v4,
$nfs_v4 = $nfs::params::nfs_v4,
$nfs_v4_export_root = $nfs::params::nfs_v4_export_root,
$nfs_v4_export_root_clients = $nfs::params::nfs_v4_export_root_clients,
$nfs_v4_idmap_domain = $nfs::params::nfs_v4_idmap_domain,
#
$service_manage = true,
#
$nfs_v4_root_export_ensure = 'mounted',
$nfs_v4_root_export_mount = undef,
$nfs_v4_root_export_remounts = false,
Expand All @@ -42,17 +48,29 @@
$nfs_v4_root_export_bindmount = undef,
$nfs_v4_root_export_tag = undef,
#
$mountd_port = undef,
$mountd_threads = 1
$mountd_port = undef,
$mountd_threads = 1,
#
$exports = undef,
) inherits nfs::params {

validate_bool($nfs_v4)
validate_bool($service_manage)
validate_bool($nfs_v4_root_export_remounts)
validate_bool($nfs_v4_root_export_atboot)

class { "nfs::server::${::nfs::params::osfamily}":
nfs_v4 => $nfs_v4,
nfs_v4_idmap_domain => $nfs_v4_idmap_domain,
mountd_port => $mountd_port,
mountd_threads => $mountd_threads,
service_manage => $service_manage,
}

include nfs::server::configure

if $exports {
create_resources(nfs::server::export, $exports)
}

}
3 changes: 2 additions & 1 deletion manifests/server/darwin.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
$nfs_v4 = false,
$nfs_v4_idmap_domain = undef,
$mountd_port = undef,
$mountd_threads = 1
$mountd_threads = 1,
$service_manage = true,
) {
fail('NFS server is not supported on Darwin')
}
Loading

0 comments on commit 2f2920b

Please sign in to comment.