Ask Your Question

Overwriting file alredy declared

asked 2014-03-25 11:01:58 -0500

Stefano gravatar image

Hi, i'm beginners in puppet/vagrant, is my first machine...i have created a local VM with puphpet and vagrant, i nedd transfer some file from host to guest (es. my.cnf, httpd.conf etc...) I have this in manifest.pp

file { "/etc/my.cnf": ensure => "present", source => [ "puppet:///files/my.cnf" ], }

I have this error:

Error: Duplicate declaration: File[/etc/my.cnf] is already declared in file /etc/puppet/modules/mysql/manifests/server/config.pp:25; cannot redeclare at /tmp/vagrant-puppet1/manifests/manifest.pp:1387 on node localhost

How to change existent file to guest machine?


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-03-25 12:54:28 -0500

doc75 gravatar image


The problem is not that the file is already existing on the machine, but you are referencing the mysql module that already manage this file. You cannot manage the same file at 2 different location in puppet. puppet is designed to define the file state of a file (some exception with usage of augeas or concat), and you cannot have 2 final state for 1 file.

You have to look at how you can pass the correct argument to mysql module so that it creates what you need in the my.cnf file.

Hope this helps.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-03-25 11:01:58 -0500

Seen: 741 times

Last updated: Mar 25 '14