I have 2 defined resources created
Download an application and set it up as a service
Create the config file for the service
I want 1 to run before 2 as 1 creates the directory which 2 creates the config file in.
But what I also need is if the config file is updated, it should notify the service in 1 to refresh. This is where I'm having a problem as I don't seem to be able to access the service.
Here is the sample code I'm using:
class start {
resource::run_service{'start'}
->
resource::conf:service_conf{'conf'}
}
define resource::run_service {
# Does some things
service { 'main':
ensure => 'running',
enable => true
}
}
define resource::conf::service_conf {
file { 'file.config':
ensure => file,
path => '/some/path/',
owner => 'user',
group => 'group',
mode => 0600,
content => template('templates/templatefile.erb'),
notify => Resource::Run_service::Service['main'], # What is the proper way to do this?
}
}
This is the error I get from puppet:
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Invalid relationship: File[file.config] { notify => Resource::Run_service::Service['main'] }, because Resource::Run_service::Service['main'] doesn't seem to be in the catalog
I can do this:
notify => Resource::Run_service['main'],
But it gives me a dependency cycle.
Is there a way I can refresh the service only?