Re: [Puppet Users] Puppet Windows Service keeps stopping/starting

2013-02-08 Thread Josh Cooper
On Fri, Feb 8, 2013 at 9:08 AM, jcbollinger  wrote:
>
>
> On Friday, February 8, 2013 3:20:33 AM UTC-6, jim wrote:
>>
>> Hello Josh
>>
>> Thanks for reply so quickly, here is my manifest, thinking about it, I
>> assume it because i'm installing the agent every time, do I need to do
>> something like if service doesn't exist install else ignore ?
>>
>> regards
>>
>> James
>>
>> file { 'C:/Installs/check-mk-agent-1.2.1i5.exe':
>> source   =>
>> 'puppet:///modules/base/check-mk-agent-1.2.1i5.exe',
>> mode => '0770',
>> owner=> 'SYSTEM',
>> group=> 'Administrators',
>> } ->
>>
>> exec { 'Check_MK_Agent':
>> command  => 'C:/Installs/check-mk-agent-1.2.1i5.exe /S',
>> } ~>
>>
>> service { 'Check_MK_Agent':
>> ensure   => 'running',
>> enable   => true,
>> require  => exec['Check_MK_Agent'],
>> }
>>
>
> It is because the Exec runs every time and has a signaling relationship
> (designated by ~>)  with the service.  (And note that the Service's
> 'require' of the Exec is redundant.)  An Exec changes state from "not run"
> to "run" when its command is successfully executed, and that triggers an
> event to be dispatched to any listeners.  Services restart if they receive
> events, which Puppet by default implements by stopping and then starting the
> service.
>
> The best approach would probably be to package the install program and
> anything else associated with the service into an installable package (i.e.
> an .msi file) and have the Service depend on the package instead of directly
> on the installer program.  If that's not feasible, then you can use one or
> more of the Exec's 'onlyif', 'unless', and 'creates' parameters to instruct
> it whether it should execute the main command on any given catalog run.
>

Also, if you are using Puppet 3, then you can use the `package`
resource to install the executable. Just make sure the package name in
the manifest matches what's in Add/Remove Programs.

Josh

-- 
Josh Cooper
Developer, Puppet Labs

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Puppet Users] Puppet Windows Service keeps stopping/starting

2013-02-08 Thread jcbollinger


On Friday, February 8, 2013 3:20:33 AM UTC-6, jim wrote:
>
> Hello Josh
>
> Thanks for reply so quickly, here is my manifest, thinking about it, I 
> assume it because i'm installing the agent every time, do I need to do 
> something like if service doesn't exist install else ignore ?
>
> regards
>
> James
>
> file { 'C:/Installs/check-mk-agent-1.2.1i5.exe':
> source   => 
> 'puppet:///modules/base/check-mk-agent-1.2.1i5.exe',
> mode => '0770',
> owner=> 'SYSTEM',
> group=> 'Administrators',
> } ->
>
> exec { 'Check_MK_Agent':
> command  => 'C:/Installs/check-mk-agent-1.2.1i5.exe /S',
> } ~>
>
> service { 'Check_MK_Agent':
> ensure   => 'running',
> enable   => true,
> require  => exec['Check_MK_Agent'],
> }
>
>
It is because the Exec runs every time and has a signaling relationship 
(designated by ~>)  with the service.  (And note that the Service's 
'require' of the Exec is redundant.)  An Exec changes state from "not run" 
to "run" when its command is successfully executed, and that triggers an 
event to be dispatched to any listeners.  Services restart if they receive 
events, which Puppet by default implements by stopping and then starting 
the service.

The best approach would probably be to package the install program and 
anything else associated with the service into an installable package (i.e. 
an .msi file) and have the Service depend on the package instead of 
directly on the installer program.  If that's not feasible, then you can 
use one or more of the Exec's 'onlyif', 'unless', and 'creates' parameters 
to instruct it whether it should execute the main command on any given 
catalog run.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Puppet Users] Puppet Windows Service keeps stopping/starting

2013-02-08 Thread jim
Hello Josh

Thanks for reply so quickly, here is my manifest, thinking about it, I 
assume it because i'm installing the agent every time, do I need to do 
something like if service doesn't exist install else ignore ?

regards

James

file { 'C:/Installs/check-mk-agent-1.2.1i5.exe':
source   => 'puppet:///modules/base/check-mk-agent-1.2.1i5.exe',
mode => '0770',
owner=> 'SYSTEM',
group=> 'Administrators',
} ->

exec { 'Check_MK_Agent':
command  => 'C:/Installs/check-mk-agent-1.2.1i5.exe /S',
} ~>

service { 'Check_MK_Agent':
ensure   => 'running',
enable   => true,
require  => exec['Check_MK_Agent'],
}


On Thursday, 7 February 2013 16:24:10 UTC, Josh Cooper wrote:
>
> Hi Jim, 
>
> On Thu, Feb 7, 2013 at 7:15 AM, jim > 
> wrote: 
> > Hello all, 
> > 
> > Can anyone please help, every time I push a config to my hosts, the 
> windows 
> > service I have just defined keeps stopping and starting, and logging in 
> the 
> > eventlog, 
> > 
> > I only want the service to stop and start, if something has changed, and 
> to 
> > my knowledge nothing has changed ? so it should stay running ? 
> > 
> > Can some one please help or explain 
> > 
> > regards 
> > 
> > James 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "Puppet Users" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to puppet-users...@googlegroups.com . 
> > To post to this group, send email to 
> > puppet...@googlegroups.com. 
>
> > Visit this group at http://groups.google.com/group/puppet-users?hl=en. 
> > For more options, visit https://groups.google.com/groups/opt_out. 
> > 
> > 
>
> From http://docs.puppetlabs.com/references/latest/type.html#service, 
> "Note that if a service receives an event from another resource, the 
> service will get restarted." 
>
> Can you post your manifest? Sounds like your service is subscribed to 
> some other resource, perhaps a package whose name doesn't match its 
> name in Add/Remove Programs? 
>
> Josh 
>
> -- 
> Josh Cooper 
> Developer, Puppet Labs 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Puppet Users] Puppet Windows Service keeps stopping/starting

2013-02-07 Thread Josh Cooper
Hi Jim,

On Thu, Feb 7, 2013 at 7:15 AM, jim  wrote:
> Hello all,
>
> Can anyone please help, every time I push a config to my hosts, the windows
> service I have just defined keeps stopping and starting, and logging in the
> eventlog,
>
> I only want the service to stop and start, if something has changed, and to
> my knowledge nothing has changed ? so it should stay running ?
>
> Can some one please help or explain
>
> regards
>
> James
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users+unsubscr...@googlegroups.com.
> To post to this group, send email to puppet-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/puppet-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

>From http://docs.puppetlabs.com/references/latest/type.html#service,
"Note that if a service receives an event from another resource, the
service will get restarted."

Can you post your manifest? Sounds like your service is subscribed to
some other resource, perhaps a package whose name doesn't match its
name in Add/Remove Programs?

Josh

--
Josh Cooper
Developer, Puppet Labs

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[Puppet Users] Puppet Windows Service keeps stopping/starting

2013-02-07 Thread jim
Hello all,

Can anyone please help, every time I push a config to my hosts, the windows 
service I have just defined keeps stopping and starting, and logging in the 
eventlog, 

I only want the service to stop and start, if something has changed, and to 
my knowledge nothing has changed ? so it should stay running ?

Can some one please help or explain 

regards

James

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.