Ask Your Question
1

puppet service with onlyif

asked 2013-11-20 15:22:29 -0500

rakkaus gravatar image

updated 2013-11-21 08:28:32 -0500

golja gravatar image

Can some one help me with puppet, I want to launch my service using something like:

service {"my_service":
  ensure     => running,
  enable     => true,
  hasstatus  => true,
  hasrestart => true,
}

but It require some folder that can appear at any time and I can't control it. So I want some thing like onlyif =>for service

seems that if my service require some exec with onlyif it's does not work...

edit retag flag offensive close merge delete

Comments

I cant use custom fact and I thinking about something like if { check that file exists } else fail('fail')

rakkaus gravatar imagerakkaus ( 2013-11-20 15:30:20 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2013-11-25 14:32:30 -0500

Stefan gravatar image

The onlyif parameter is only available for the exec resource. The problem here is that in puppet you define the desired state of the system and puppet will make sure to change the current state to the desired state (if necessary). In your situation your desired state (either "make sure service is running" or "dont care about service") depends on the current state ("is directoy X available?").

The only way to inform the puppet master about the current state (to make the above decision wether the agent should manage the service or not) is to write a custom facts. But ... (more)

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

Stats

Asked: 2013-11-20 15:22:29 -0500

Seen: 1,883 times

Last updated: Nov 25 '13