# Revision history [back]

### 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,
}

}

 2 No.2 Revision Ancillas 2828 ●19 ●39 ●71 http://www.techgamelif...

### 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,
}

}