简体   繁体   中英

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. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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