Giter Site home page Giter Site logo

puppet-nfs's Introduction

NFS Puppet module

Puppet Forge Version Puppet Forge Downloads Build Status Puppet Forge Endorsement By Camptocamp

Examples

Client node ::

node "my-nfs-client" {
  include nfs::client
  nfs::mount {"my mounted one":
    share       => '/srv/nfs/myshare',
    mountpoint  => '/mnt/nfs/myshare',
    ensure      => present,
    server      => "nfs.mydomain.ltd",
  }

  nfs::mount {"my unwanted one":
    share       => '/srv/nfs/myshare',
    mountpoint  => '/mnt/nfs/myshare',
    ensure      => absent,
    server      => "nfs.mydomain.ltd",
  }
}

Server node ::

node "my-nfs-server" {
  include nfs::server

  Nfs::Export <<| tag == "nfs.mydomain.ltd" |>>
}

puppet-nfs's People

Contributors

andreas-h avatar cjeanneret avatar ckaenzig avatar ckyriakidou avatar danielfaulknor avatar dimitristeyaert avatar hovisjovis avatar intrigeri avatar jgodin-c2c avatar matikij avatar mbornoz avatar mcanevet avatar mremy avatar nikolavp avatar raphink avatar saimonn avatar saz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

puppet-nfs's Issues

Debian Jessie: Failed to start portmap.service

Hi,

In params.pp you should add an extra option that sets the portmap variable for Debian Jessie to 'rpcbind'. Because now while trying to start the portmap service on Jessie I get:

Error: Could not start Service[portmap]: Execution of '/usr/sbin/service portmap start' returned 6: Failed to start portmap.service: Unit portmap.service failed to load: No such file or directory.

It is trying to start the default selection being 'portmap' which should actually be 'rcpbind'.

Duplicate declaration error when the same share mounted twice on a client

When I have two nfs::mount resources like:

nfs::mount {
  "/var/mountpoint1":
    ensure => present,
    server => nfs.local,
    share => /share,
    mountpoint => "/var/mountpoint1"
    ;
  "/var/mountpoint2":
    ensure => present,
    server => nfs.local,
    share => /share,
    mountpoint => "/var/mountpoint2"
    ;
}

I get an Duplicate declaration error like:

Error: Could not retrieve catalog from remote server:
 Error 500 on SERVER: Server Error: Evaluation Error:
 Error while evaluating a Resource Statement, Evaluation Error:
 Error while evaluating a Resource Statement, Duplicate declaration:
 Nfs::Export[shared /share by nfs.local for node.local] is already declared at 
  (file: .../modules/nfs/manifests/mount.pp, line: 12); cannot redeclare (file: .../modules/nfs/manifests/mount.pp, line: 12)
  (file: .../modules/nfs/manifests/mount.pp, line: 12, column: 3)
[...]

This is because the exported @@nfs::export resource in https://github.com/camptocamp/puppet-nfs/blob/master/manifests/mount.pp#L12 doesn't include the $mountpoint in it's $title

The fragments directory is empty, cowardly refusing to make empty config files

Added puppet-nfs and also added the concat module (not mentioned anywhere as a requirement!).

Tried setting up a server share, the documentation doesn't mention how to share a folder but I copied the example on my server node:

include nfs::server

Nfs::Export <<| tag == "nfs.mydomain.ltd" |>>

How do you tell it which folder to share?

Notice: /Stage[main]/Nfs::Server::Debian/Concat[/etc/exports]/Exec[concat_/etc/exports]/returns: The fragments directory is empty, cowardly refusing to make empty config files
Error: /var/lib/puppet/concat/bin/concatfragments.sh -o /var/lib/puppet/concat/_etc_exports/fragments.concat.out -d /var/lib/puppet/concat/_etc_exports returned 1 instead of one of [0]
Error: /Stage[main]/Nfs::Server::Debian/Concat[/etc/exports]/Exec[concat_/etc/exports]/returns: change from notrun to 0 failed: /var/lib/puppet/concat/bin/concatfragments.sh -o /var/lib/puppet/concat/_etc_exports/fragments.concat.out -d /var/lib/puppet/concat/_etc_exports returned 1 instead of one of [0]
Notice: /Stage[main]/Nfs::Server::Debian/Concat[/etc/exports]/File[/etc/exports]: Dependency Exec[concat_/etc/exports] has failures: true
Warning: /Stage[main]/Nfs::Server::Debian/Concat[/etc/exports]/File[/etc/exports]: Skipping because of failed dependencies
Notice: /Stage[main]/Nfs::Server::Debian/Exec[reload_nfs_srv]: Dependency Exec[concat_/etc/exports] has failures: true

provider needs to be parameterized for Service[] resources

upstart does not seem to work well on docker containers. I have tried adding to the top scope of my role:

  Service { provider => 'init' }
  # if $::is_docker_container { Service { provider => 'init' } }

And while it seems to be working for the moment, I fear the implications this might have for services which provide no init.d script. And in fact, that creates a conflict right here in this module:

Error: /Service[nfs-common]: Could not evaluate: Could not find init script for 'statd'

Were the provider parameterized, I could control this knob on a service-by-service basis from hiera or by passing an attribute to the class invocation.

dependency cycle

Ubuntu 14.04:

Error: Could not apply complete catalog: Found 1 dependency cycle:
(Exec[concat_/etc/exports] => Concat[/etc/exports] => Service[nfs-kernel-server] => Class[Nfs::Server::Debian] => Concat[/etc/exports] => Exec[concat_/etc/exports])

Ephemeral IP in export file

I had a test server with IP 1.1.1.1, then I removed this IP everywhere in manifests, even restart NFS server, like windows :)
But this IP appears again in export 1.1.1.1, like this

/nfs_server     2.2.2.2(rw,fsid=0,insecure,no_subtree_check,async,no_root_squash)
/nfs_server     1.1.1.1

Could you prompt me where I could look for to resolve , please?

Incorrect value assigned to $portmap service for Ubuntu 12.04

  • Portmap package name for Ubuntu 12.04 (and earlier) is called rpcbind. But it's service name is portmap. This difference causes an error when this puppet module is applied to Ubuntu 12.04 and earlier.
Error: /Stage[main]/Nfs::Client::Debian/Service[rpcbind]: Could not evaluate: Could not find init script or upstart conf file for 'rpcbind'
ubuntu@backup01:~/all-6$ sudo facter | grep lsbdist
lsbdistcodename => precise
lsbdistdescription => Ubuntu 12.04.5 LTS
lsbdistid => Ubuntu
lsbdistrelease => 12.04

ubuntu@backup01:~/all-6$ dpkg -L rpcbind | grep init
/etc/init
/etc/init/portmap-wait.conf
/etc/init/rpcbind-boot.conf
/etc/init/portmap.conf
/etc/init.d
/etc/init.d/portmap
/etc/init.d/rpcbind-boot
/etc/init.d/portmap-wait
  • However, on Ubuntu 14.04 (and later) the service name and package name are the same.

vagrant@web01:~$ sudo facter | grep lsbdist
lsbdistcodename => trusty
lsbdistdescription => Ubuntu 14.04.1 LTS
lsbdistid => Ubuntu
lsbdistrelease => 14.04

vagrant@web01:~$ dpkg -L rpcbind | grep init
/etc/init
/etc/init/rpcbind-boot.conf
/etc/init/portmap-wait.conf
/etc/init/rpcbind.conf
/etc/init.d
/etc/init.d/rpcbind

Suggested solution

  • Use different variables for portmap service and package names so as to be explicit since the names are not always the same.

Help with export

Hi,

I can't have nfs::export working, concat is working on another module (keepalived)
I can't find why, any idea ?

I've tried

nfs::export {'/data/sftproot':
    guest => 'myserver',
    share => '/data/sftproot',
    ensure => present,
    options => 'rw,root_squash,sync',
    require => File['/data/sftproot']
  }

and

Nfs::Export <<| tag == "myserver" |>>

But I always have this error :

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Invalid relationship: File[/var/lib/puppet/concat/_etc_exports/fragments/10__data_sftproot--data-sftproot-sftp-on-myserver] { notify => Exec[concat_/etc/exports] }, because Exec[concat_/etc/exports] doesn't seem to be in the catalog
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

CentOS 6.5 nfs v4 error

error report:
Notice: /Stage[main]/Nfs::Client::Redhat/Package[nfs-utils]/ensure: created
Error: Could not start Service[nfs]: Execution of '/sbin/service nfs start' returned 1: Starting NFS services: [ OK ]
Starting NFS mountd: [FAILED]
Starting NFS daemon: rpc.nfsd: writing fd to kernel failed: errno 111 (Connection refused)
rpc.nfsd: unable to set any sockets for nfsd
[FAILED]
Wrapped exception:
Execution of '/sbin/service nfs start' returned 1: Starting NFS services: [ OK ]
Starting NFS mountd: [FAILED]
Starting NFS daemon: rpc.nfsd: writing fd to kernel failed: errno 111 (Connection refused)
rpc.nfsd: unable to set any sockets for nfsd
[FAILED]
Error: /Stage[main]/Nfs::Server::Redhat/Service[nfs]/ensure: change from stopped to running failed: Could not start Service[nfs]: Execution of '/sbin/service nfs start' returned 1: Starting NFS services: [ OK ]
Starting NFS mountd: [FAILED]
Starting NFS daemon: rpc.nfsd: writing fd to kernel failed: errno 111 (Connection refused)
rpc.nfsd: unable to set any sockets for nfsd
[FAILED]
Notice: /Stage[main]/Nfs::Client::Redhat/Service[rpcbind]/ensure: ensure changed 'stopped' to 'running'
Info: /Stage[main]/Nfs::Client::Redhat/Service[rpcbind]: Unscheduling refresh on Service[rpcbind]
Notice: /Stage[main]/Nfs::Client::Redhat/Service[nfslock]/ensure: ensure changed 'stopped' to 'running'
Info: /Stage[main]/Nfs::Client::Redhat/Service[nfslock]: Unscheduling refresh on Service[nfslock]
Notice: Finished catalog run in 5.35 seconds

under debian, nfs::server doesn't start the service, so nfs::export can't reload it

Hi,

We are using your module under debian 7.

When you installed the package nfs-kernel-server, a empty file /etc/exports is created (not really empty but there is only comments).

Just after the installation, Debian tried to start the service but it failed :

[ ok ] Starting NFS common utilities: statd idmapd.
[warn] Not starting NFS kernel daemon: no exports. ... (warning).

If the file /etc/exports is empty it can't start the process.

Now with puppet.

This is a part of the code we are using :

include nfs::server

nfs::export { 'share':
  guest => '192.168.1.0/24',
  share => '/path/to/my/share',
  options => 'rw,async,no_root_squash',
}

and you can read below a part of the report

# grep -E '(nfs-kernel-server|reload_nfs_srv)' report.txt
==> vagrant: Debug: /Package[nfs-kernel-server]: Provider apt does not support features virtual_packages; not managing attribute allow_virtual
==> vagrant: Debug: /Stage[main]/Nfs::Server::Debian/Exec[reload_nfs_srv]/require: requires Package[nfs-kernel-server]
==> vagrant: Debug: /Stage[main]/Nfs::Server::Debian/Concat[/etc/exports]/notify: subscribes to Exec[reload_nfs_srv]
==> vagrant: Debug: Executing '/usr/bin/dpkg-query -W --showformat '${Status} ${Package} ${Version}\n' nfs-kernel-server'
==> vagrant: Debug: Executing '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install nfs-kernel-server'
==> vagrant: Notice: /Stage[main]/Nfs::Server::Debian/Package[nfs-kernel-server]/ensure: ensure changed 'purged' to 'present'
==> vagrant: Debug: /Package[nfs-kernel-server]: The container Class[Nfs::Server::Debian] will propagate my refresh event
==> vagrant: Debug: Executing '/etc/init.d/nfs-kernel-server status'
==> vagrant: Debug: Executing '/etc/init.d/nfs-kernel-server start'
==> vagrant: Notice: /Stage[main]/Nfs::Server::Debian/Service[nfs-kernel-server]/ensure: ensure changed 'stopped' to 'running'
==> vagrant: Debug: /Stage[main]/Nfs::Server::Debian/Service[nfs-kernel-server]: The container Class[Nfs::Server::Debian] will propagate my refresh event
==> vagrant: Info: /Stage[main]/Nfs::Server::Debian/Service[nfs-kernel-server]: Unscheduling refresh on Service[nfs-kernel-server]
==> vagrant: Info: Concat[/etc/exports]: Scheduling refresh of Exec[reload_nfs_srv]
==> vagrant: Debug: Exec[reload_nfs_srv](provider=posix): Executing check '/etc/init.d/nfs-kernel-server status'
==> vagrant: Debug: Executing '/etc/init.d/nfs-kernel-server status'
==> vagrant: Debug: /Stage[main]/Nfs::Server::Debian/Exec[reload_nfs_srv]/onlyif: nfsd not running
==> vagrant: Notice: /Stage[main]/Nfs::Server::Debian/Exec[reload_nfs_srv]: Triggered 'refresh' from 1 events
==> vagrant: Debug: /Stage[main]/Nfs::Server::Debian/Exec[reload_nfs_srv]: The container Class[Nfs::Server::Debian] will propagate my refresh event

With words, the Package is installed, the service tried to start without success, then the Service tried to start again, then we pushed a Config file and we tried to Reload a service not started. Finally, the service is never started with the right config file.

This patch solve my problem :

--- manifests/server/debian.pp.orig 2015-07-29 12:28:59.218034199 +0200
+++ manifests/server/debian.pp  2015-07-29 12:29:57.370164880 +0200
@@ -5,24 +5,18 @@
     ensure => present,
   }

-  exec {'reload_nfs_srv':
-    command     => '/etc/init.d/nfs-kernel-server reload',
-    onlyif      => '/etc/init.d/nfs-kernel-server status',
-    refreshonly => true,
-    require     => Package['nfs-kernel-server'],
-  }
-
   service {'nfs-kernel-server':
     ensure  => $nfs::server::service_running,
     enable  => $nfs::server::service_enable,
     pattern => 'nfsd',
+    require => Package['nfs-kernel-server'],
   }

   @concat {'/etc/exports':
     owner  => root,
     group  => root,
     mode   => '0644',
-    notify => Exec['reload_nfs_srv'],
+    notify => Service['nfs-kernel-server'],
   }

 }

Before creating a pull request, i would like to check with you if I didn't forget anything.

Thomas

Debian 9 (Stretch): nfs::client::debian tries to start nfs-common.service, which is masked

Error: Could not start Service[nfs-common]: Execution of '/usr/sbin/service nfs-common start' returned 1: Failed to start nfs-common.service: Unit nfs-common.service is masked.
Error: /Stage[main]/Nfs::Client::Debian/Service[nfs-common]/ensure: change from stopped to running failed: Could not start Service[nfs-common]: Execution of '/usr/sbin/service nfs-common start' returned 1: Failed to start nfs-common.service: Unit nfs-common.service is masked.

Note that my NFS v4 mounts work fine on this system anyway, so at least for NFS v4 no additional service is needed aside of what the packages installed by this module enable by default. But NFS v2/3 clients might require some other service (presumably rpc-statd like on Red Hat 7). I'll try something and will report back.

nfs version 4

Hello,

Could you please advise is it possible to specify NFS version using that module ?

We need to use NFS 3 for most of shares and specify NFS version 4 for particular exports.

Thanks in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.