大佬教程收集整理的这篇文章主要介绍了linux – 如何从puppet管理挂载的分区(fstab挂载点),大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
例如,默认情况下,目录的所有者是root,如果已安装分区的根(/)有另一个所有者,puppet将尝试更改它,我不希望这样.我知道我可以设置该目录的所有者,但为什么我应该关心挂载分区上的内容?我想做的就是装上它.有没有办法让puppet不关心用作挂载点的目录的权限?
这就是我现在正在使用的:
define extra_mount_point( $device,$LOCATIOn = "/mnt",$fstype = "xfs",$owner = "root",$group = "root",$mode = 0755,$seltype = "public_content_t" $options = "ro,relatime,nosuid,nodev,noexec",) { file { "${LOCATIOn}/${name}": ensure => directory,owner => "${owner}",group => "${group}",mode => $mode,seltype => "${seltypE}",} mount { "${LOCATIOn}/${name}": atboot => true,ensure => mounted,device => "${devicE}",fstype => "${fstypE}",options => "${options}",dump => 0,pass => 2,require => File["${LOCATIOn}/${name}"],} } extra_mount_point { "sda3": device => "/dev/sda3",fstype => "xfs",owner => "ciupicri",group => "ciupicri",$options => "relatime,}
如果重要,我正在使用puppet-0.25.4-1.fc13.noarch.rpm和puppet-server-0.25.4-1.fc13.noarch.rpm.
附: undef适用于所有者,组和权限,但不适用于SELinux.如果分区已经安装,木偶抱怨:
puppetd[18052]: Failed to set SELinux context system_u:object_r:public_content_t:s0 on /mnt/sda3 puppetd[18052]: (/File[/mnt/sda3]/seluser) seluser changed 'unconfined_u' to 'system_u' puppetd[18052]: Failed to set SELinux context unconfined_u:object_r:mnt_t:s0 on /mnt/sda3 puppetd[18052]: (/File[/mnt/sda3]/seltypE) seltype changed 'public_content_t' to 'mnt_t'
已安装分区的权限是:
drwxr-xr-x. root root unconfined_u:object_r:public_content_t:s0 /mnt/sda3/
而puppet创建的挂载点的权限是:
drwxr-xr-x. root root system_u:object_r:mnt_t:s0 /mnt/sda3/
file { "${LOCATIOn}/${name}": ensure => directory,owner => undef,group => undef,mode => undef,selinux_ignore_defaults => true,}
在这种情况下,如果在安装之前目录不存在,它将被创建为作为puppetd启动的用户和组(可能是root:wheel)和默认的umask. Puppet不会关心创建时或任何后续运行时设置的内容.
或者,如果您想交换一点复杂性来保证,您可以使用自定义事实来确定活动挂载是什么,并使用switch语句来设置目录权限,具体取决于它是预安装还是后安装.
以上是大佬教程为你收集整理的linux – 如何从puppet管理挂载的分区(fstab挂载点)全部内容,希望文章能够帮你解决linux – 如何从puppet管理挂载的分区(fstab挂载点)所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。