Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Overwrite file if it exists or create file if it does not

Hi

I am trying to rewrite a file using puppet with the following function.

If the file exists I still want the file to be rewrite from the source. Will this be achieved with the following method?

define setup_sysctl_conf( $dependence=File[$dummy_dependence_file] )
{
    file { $name:
     path    => '/etc/sysctl.conf',
             ensure  => present,
     mode    => 0777,
     source  => '/vagrant/files/sysctl.conf',
     require => $dependence, 
 }

}

Overwrite file if it exists or create file if it does not

Hi

I am trying to rewrite a file using puppet with the following function.

If the file exists I still want the file to be rewrite from the source. Will this be achieved with the following method?

define setup_sysctl_conf( $dependence=File[$dummy_dependence_file] )
{
    file { $name:
     path    => '/etc/sysctl.conf',
      ensure  => present,
     mode    => 0777,
     source  => '/vagrant/files/sysctl.conf',
     require => $dependence, 
 }

}