Using puppet on nfs mounts with root squashed

61 views
Skip to first unread message

Brian

unread,
Mar 27, 2010, 1:29:05 PM3/27/10
to Puppet Users
Hi,

I would like to use the file resource type to place files in users
home directories via puppet. This doesn't work on systems where home
directories are provided via nfs and root_squash is enabled on the nfs
server. Is there a way to work around this in puppet, similar to how
the exec resource type can specify what user it will run as?

All the best,
Brian Pitts

Adam Gray

unread,
Mar 30, 2010, 12:51:34 PM3/30/10
to puppet...@googlegroups.com
Since the puppet clients are running as local root, they would need to drop privileges to a uid with access to the NFS mount in order to source the files. You could make an exec {} to look and feel like a file {}, but it would really have to copy files from NFS somewhere local (/tmp?) then move from there to the final destination. This is completely untested and uneducated, but here's an attempt (I don't even know if you can require exec's):
define nfsfile($type = file, $mode = 644, $owner = root, $group = root) {
   exec { copiescopiescopies:
      command => "sudo -u nfsperson cp /path/to/nfs/$name /tmp/puppettemp"
   }
   file { $name:
      require => Exec[copiescopiescopies],
      source => "/tmp/puppettemp",
      mode => $mode,
      owner => $owner,
      group => $group,
   }
}

-adam



--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.


Reply all
Reply to author
Forward
0 new messages