简体   繁体   English

人偶文件资源需要检查源是否可用并且目标是R / W

[英]Puppet file resource need to check source is available and target is R/W

I have the following puppet class. 我有以下木偶课。

class vintela_monitor::keytab {
  file { '/etc/vasinst.key':
    ensure => 'present',
    source => '/auto/hosting-hard/QAS/creds/keytabs/vas_engit.keytab',
  }
} 

I need to make sure the source is accessible (cd to that directory) and that the target file system is in read write mode before executing this. 在执行此操作之前,我需要确保源可访问(该目录的cd)并且目标文件系统处于读写模式。 How can I achieve this? 我该如何实现?

You can use the attribute mode of the resource file 您可以使用资源文件的属性模式

 file { '/auto/hosting-hard/QAS/creds/keytabs/vas_engit.keytab':
    ensure  => 'present',
    mode => '777',
 } 

  file { '/etc/vasinst.key':
    ensure  => 'present',
    source  => '/auto/hosting-hard/QAS/creds/keytabs/vas_engit.keytab',
    require => File["/auto/hosting-hard/QAS/creds/keytabs/vas_engit.keytab"],
  }

You can see more about mode and permessions here 您可以在此处查看有关模式和渗透的更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM