The doll does not add my service to run

I have this doll module (monit) in which I declare the monit service enabled (aka starts when the machine boots)

class monit { $configdir = "/etc/monit.d" package { "monit": ensure => installed; } service { "monit": ensure => running, enable => true, require => Package["monit"], provider => init; } file { '/etc/monit.d': ensure => directory; '/etc/monit.conf': content => template('monit/monitrc.erb'), mode => 0600, group => root, require => File['/etc/monit.d'], before => Service[monit], notify => Service[monit], } } 

Then I turned on with include monit by default node. However, when I apply this configuration, the puppet does not install monit as a launch service (use chkconfig -list monit, just displaying "off" and "off")

However, if I run puppet apply -e 'service { "monit": enable => true, } ' , then monit is added to run correctly.

Am I really doing something wrong? (Puppet 2.7.6)

The full configuration can be displayed at https://github.com/phuongnd08/Giasu-puppet

+4
source share
1 answer

The problem is probably in the line provider => init , which overrides the default provider for processing services. The initialization provider is a very simple provider that does not support the "enableable" function, so it cannot set the service to start at startup.

See http://docs.puppetlabs.com/references/2.7.6/type.html#service for your options.

In your puppet apply example, you don’t specify the provider to choose the most suitable one for your system - in your case, the redhat provider that uses chkconfig .

To fix this, remove the provider string from your service {} definition and it will again be the most suitable by default. You need to specify the provider if he chose the wrong one, and then it is better to specify it as a global default value.

+8
source

Source: https://habr.com/ru/post/1379833/


All Articles