Require file for mount and also update the file after mount?

Posted by Andy Shinn on Server Fault See other posts from Server Fault or by Andy Shinn
Published on 2012-09-24T21:28:13Z Indexed on 2012/09/24 21:39 UTC
Read the original article Hit count: 141

Filed under:

I am trying to make sure a directory exists for a mount and then also update the permissions of that directory after the mount happens. I am receiving the following error:

err: Failed to apply catalog: Cannot alias File[pre_eos_mount] to ["/var/tmp/eos"] at /etc/puppet/modules/mymodule/manifests/eos.pp:29; resource ["File", "/var/tmp/eos"] already declared at /etc/puppet/modules/mymodule/manifests/eos.pp:47

I would like to do something like this:

file { $eos_mount :
    ensure  => 'directory',
    mode    => '1777',
    owner   => 'root',
    group   => 'root',
  }

  mount { $eos_mount :
    ensure  => 'mounted',
    device  => $lv_device,
    fstype  => $fstype,
    options => 'defaults,noatime,nodiratime',
    require => File[$eos_mount],
    notify  => File['post_eos'],
  }

  file { 'post_eos' :
    path    => $eos_mount,
    ensure  => 'directory',
    mode    => '1777',
    owner   => 'root',
    group   => 'root',
  }

What is a way to ensure permissions of a folder after it has been mounted?

© Server Fault or respective owner

Related posts about puppet