Ask Your Question
0

start / restart service

asked 2017-03-27 23:47:15 -0500

fbarboza01 gravatar image

How do I specify in puppet the start/restart of a service If I have ubuntu 14 and ubuntu 16.x and all the other ubuntu versions that will come. For ubuntus 16X + I have to use systemd and for lower versions like 14, I use /etc/init.d/xxx [start,restart,stop] etc.

How do I specify that so puppet knows the way to action according the release of the ubuntu OS.

Thanks.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-03-28 13:04:27 -0500

puser gravatar image

updated 2017-03-28 14:07:37 -0500

It just knows....

When you modify a config file for a service add this parameter:

Notify['systemd']

It will restart the service for you, knowing the kernel and version you are using to do it properly.

One or more resources that depend on this resource, expressed as resource references. Multiple resources can be specified as an array of references. When this attribute is present:

This resource will be applied before the notified resource(s). If Puppet makes changes to this resource, it will cause all of the notified resources to refresh. (Refresh behavior varies by resource type: services will restart, mounts will unmount and re-mount, etc. Not all types can refresh.) This is one of the four relationship metaparameters, along with before, require, and subscribe. For more context, including the alternate chaining arrow (-> and ~>) syntax, see the language page on relationships.

https://docs.puppet.com/puppet/4.9/me...

edit flag offensive delete link more

Comments

1

Seconded, that is the 'beauty' of the abstraction layer of puppet, the internal types/providers will figure out the differences between sysv / systemd / upstart / etc... The only complication that comes up sometimes is when the service names are different per platform, but params.pp/data in modules

DarylW gravatar imageDarylW ( 2017-03-29 08:31:00 -0500 )edit

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: 2017-03-27 23:47:15 -0500

Seen: 61 times

Last updated: Mar 28