Puppet - OSX NFS挂载刷新和触发重新安装

时间:2015-04-23 15:56:32

标签: macos puppet osx-yosemite mount nfs

我已经和它斗争了一段时间,而且我把它缩小到一个测试木偶清单,说明问题。

基本上,我定义了File资源,然后定义了Mount资源以在该目录中挂载NFS共享。但是,查看调试输出,看起来目录的检查是触发"刷新"事件,这反过来导致Puppet卸载并重新安装共享。此过程中的某些内容会导致删除目录,从而导致重新安装失败。

我在运行装载刷新之前检查了/ Volumes目录,并且 创建了目录,所以我只能假设它是{{ 1}}命令删除它。

我尝试使用umount依赖于文件资源(如下所示)并使用对Mount资源的before依赖关系,结果相同。

示例Puppet清单:

require

这里是file { "/Volumes/share": ensure => directory, before => Mount["/Volumes/share"] } mount {"/Volumes/share": ensure => "mounted", device => "xxxx@yyyy.net:/share", name => "/Volumes/share", atboot => true, fstype => "nfs", options => "", } 输出:

--debug

编辑:

我发现其中一个失败的主机刚刚开始工作,好像是通过魔术。我收集了它开始工作的报告:

Debug: Loaded state in 0.02 seconds
Debug: /Stage[main]/Main/File[/Volumes/share]/before: requires Mount[/Volumes/share]
Info: Applying configuration version '1429802875'
Notice: /Stage[main]/Main/File[/Volumes/share]/ensure: created
Debug: /Stage[main]/Main/File[/Volumes/share]: The container Class[Main] will propagate my refresh event
Debug: Prefetching parsed resources for mount
Debug: Executing '/sbin/mount'
Debug: Flushing mount provider target /etc/fstab
Info: Computing checksum on file /etc/fstab
Notice: /Stage[main]/Main/Mount[/Volumes/share]/ensure: ensure changed 'unmounted' to 'mounted'
Debug: Executing '/sbin/mount -o  /Volumes/share'
Debug: /Stage[main]/Main/Mount[/Volumes/share]: The container Class[Main] will propagate my refresh event
Info: /Stage[main]/Main/Mount[/Volumes/share]: Scheduling refresh of Mount[/Volumes/share]
Info: Mount[/Volumes/share](provider=parsed): Remounting
Debug: Executing '/sbin/umount /Volumes/share'
Debug: Executing '/sbin/mount -o  /Volumes/share'
Error: /Stage[main]/Main/Mount[/Volumes/share]: Failed to call refresh: Execution of '/sbin/mount -o  /Volumes/share' returned 1: mount: realpath /Volumes/share: No such file or directory
Error: /Stage[main]/Main/Mount[/Volumes/share]: Execution of '/sbin/mount -o  /Volumes/share' returned 1: mount: realpath /Volumes/share: No such file or directory
Debug: Class[Main]: The container Stage[main] will propagate my refresh event
Debug: Finishing transaction 70139321047620
Debug: Storing state
Debug: Stored state in 0.11 seconds
Notice: Finished catalog run in 0.70 seconds
Debug: Using settings: adding file resource 'rrddir': 'File[/var/lib/puppet/rrd]{:path=>"/var/lib/puppet/rrd", :mode=>"750", :owner=>"root", :ensure=>:directory, :loglevel=>:debug, :links=>:follow, :backup=>false}'
Debug: Finishing transaction 70139327177180
Debug: Received report to process from zzzz.yyyy.net
Debug: Processing report from zzzz.yyyy.net with processor Puppet::Reports::Store

然后(稍后):

//aaaa.yyyy.net//Stage[main]/Osx-common/Mount[/Volumes/share]   Failed to call refresh: Execution of '/sbin/mount -o /Volumes/share' returned 1: mount: realpath /Volumes/share: No such file or directory
//aaaa.yyyy.net//Stage[main]/Osx-common/Mount[/Volumes/share]   Execution of '/sbin/mount -o /Volumes/share' returned 1: mount: realpath /Volumes/share: No such file or directory

又一次失败,后来再次出现:

//aaaa.yyyy.net//Stage[main]/Osx-common/Mount[/Volumes/share]   Could not evaluate: Execution of '/sbin/mount -o /Volumes/share' returned 61: mount_nfs: warning: option "0" not known mount_nfs: can't mount /share from zzzz.yyyy.net onto /Volumes/share: Connection refused

最后:

//aaaa.yyyy.net/Puppet  Failed to set owner to '501': No such file or directory - /Volumes/share
//aaaa.yyyy.net//Stage[main]/Osx-common/File[/Volumes/share]/owner  change from root to administrator failed: Failed to set owner to '501': No such file or directory - /Volumes/share
//aaaa.yyyy.net/Puppet  Failed to set group to '21': No such file or directory - /Volumes/share
//aaaa.yyyy.net//Stage[main]/Osx-common/File[/Volumes/share]/group  change from wheel to administrator failed: Failed to set group to '21': No such file or directory - /Volumes/share
//aaaa.yyyy.net/Puppet  failed to set mode 555 on /Volumes/share: No such file or directory - /Volumes/share
//aaaa.yyyy.net//Stage[main]/Osx-common/File[/Volumes/share]/mode   change from 0555 to 0777 failed: failed to set mode 555 on /Volumes/share: No such file or directory - /Volumes/share
//aaaa.yyyy.net//Stage[main]/Osx-common/Mount[/Volumes/share]   Dependency File[/Volumes/share] has failures: true
//aaaa.yyyy.net//Stage[main]/Osx-common/Mount[/Volumes/share]   Skipping because of failed dependencies

这就是它的工作原理。我不知道为什么这台主机现在正常工作,但第一台主机失败了,如上所述!

1 个答案:

答案 0 :(得分:1)

您可以尝试使用木偶订购箭头。

file { "/Volumes/share":
  ensure => directory,
}

mount {"/Volumes/share":
  ensure  => "mounted",
  device  => "xxxx@yyyy.net:/share",
  name    => "/Volumes/share",
  atboot  => true,
  fstype  => "nfs",
  options => "",
}

File["/Volumes/share"] -> Mount["/Volumes/share"]