Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does it ever make sense to ensure => file AND ensure => present in init.pp

Tags:

puppet

Does it ever make sense to ensure a file is both present and file? Does present imply it's a file or does the file { '/etc/sendmail': line define it as a file?

class sendmail {

    file { '/etc/sendmail':
      ensure => directory,
      mode => 755
    }

    file { '/etc/sendmail/sendmail.cf':
      ensure  => present,
      ensure  => file,
      backup  => false,
      source => 'puppet:///mymodules/sendmail/sendmail.cf',
    }

    file { '/etc/sendmail/submit.cf':
      ensure  => present,
      ensure  => file,
      backup  => false,
      source => 'puppet:///mymodules/sendmail/submit.cf',
    }

    service {'sendmail': 
      ensure => running
    }

}
like image 313
mr.zog Avatar asked May 16 '14 17:05

mr.zog


1 Answers

ensure => file implies ensure => present. That is to say the resource should be a file and if is not a file or does not exist, create a file.

ensure => present just means that the resource should be a file, directory, or link; if it does not exist, create a file.

So to answer your question: no, it does not make sense to do so.

For more information about ensure, check out the documentation for the file type.

like image 140
Peter Huene Avatar answered Sep 21 '22 12:09

Peter Huene