I need to write puppet code that will stop a service, make a change to a file then start the service. I can not change the file wile it is running. That is why I need to stop the service first. I had this test code:
Code:
service { cupsd : ensure => stopped } -> file { "/home/testing": ensure => true } -> service { cupsd : ensure => running }
But when I run it throws an error saying:
Code:
Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate declaration: Service[cupsd] is already declared in file /etc/puppet/modules/test/manifests/init.pp at line 2; cannot redeclare on node
I am not sure how to work around this error or how to "declare" something twice.
Any help would be great.
Thanks