Re: [Puppet Users] Re: Check service running with flag file

2015-06-18 Thread Eddie Mashayev
Hi, Found a solution: Create ruby script in: root@foreman]# cat /etc/puppet/environments/production/modules/customfacts/lib/facter/check_file_exsist.rb Facter.add('check_nails_exsist') do setcode do File.exists?('/etc/NONAILS') end end We are checking if /etc/NONAILS exist, if yes return

Re: [Puppet Users] Re: Check service running with flag file

2015-06-11 Thread jcbollinger
On Thursday, June 11, 2015 at 7:24:57 AM UTC-5, Eddie Mashayev wrote: > > > Thanks, do you have any other suggestion how can I do it properly? > > I want “nails” process to be running only if there is no /etc/NONAILS flag > in my OS. > > The canonical way to inform the catalog compiler about no

Re: [Puppet Users] Re: Check service running with flag file

2015-06-11 Thread Eddie Mashayev
Thanks, do you have any other suggestion how can I do it properly? I want “nails” process to be running only if there is no /etc/NONAILS flag in my OS. On Thursday, June 11, 2015 at 1:01:55 PM UTC+3, Craig Dunn wrote: > > On reading this again, what you are trying to do won't work - you are

Re: [Puppet Users] Re: Check service running with flag file

2015-06-11 Thread Craig Dunn
On reading this again, what you are trying to do won't work - you are requiring that the exec resource be "satisfied" before the service starts - if the exec resource doesn't run because onlyif returns false, this is normal behaviour and not a failure, therefore the resource is still satisfied and

Re: [Puppet Users] Re: Check service running with flag file

2015-06-11 Thread Craig Dunn
You haven't provided a command to run via the command attribute, so the provider will attempt to execute what you have in the resource title (checkForFile) - that is to say, it is trying to execute the command 'checkForFile', which of course, doesn't exist. As Denmat already pointed out, this may

Re: [Puppet Users] Re: Check service running with flag file

2015-06-11 Thread Denmat
Hi, May not be the best solution but you can specify the command to run when starting a service, you could use that instead. service {blah: start => 'test && service blah start' } Alternatively you might want to put logic in the init file, into a facter value or some other way. Cheers