FAQ
Hi,

I'm having trouble with an exec type. I'm using an exec type to start a
buildbot slave. It's a long-running pseudo-service. The exec uses the
"refresh" and "onlyif". I think that the refresh command isn't running
because of the onlyif attribute. I would like a refresh event to fire
even if the "onlyif" attribute is in use. Any help is appreciated. Do I
need to split it into two exec's (one normal and another refreshonly)?


Here is a snippet from the type definition:
==============
define buildbot::slave::instance( ..., $project_dir, ... ) {

$path = ['/usr/local/bin','/usr/bin','/bin']
$config_files =
["$project_dir/info/admin","$project_dir/info/host"]

# commands to work with the buildslave
$slave_install_command = "buildslave create-slave $project_dir
$master_host_port $slave_name $slave_password"
$slave_start_command = "buildslave start $project_dir"
$slave_restart_command = "buildslave restart $project_dir"
$slave_status_command = "/bin/kill -0 `/bin/cat
$project_dir/twistd.pid`"

...snip...

exec { $slave_start_command:
cwd => $project_dir,
path => $path,
user => $user,
group => $group,
unless => $slave_status_command,
refresh => $slave_restart_command,
require => File[$config_files],
subscribe => File[$config_files],
}
======
Here is part of the debug log:

Info:
/Stage[main]//Buildbot::Slave::Instance[openafs1]/File[/home/buildslave/buildbot/openafs/info/admin]:
Filebucketed /home/buildslave/buildbot/openafs/info/ad
min to puppet with sum 2f840fdf8acf7c334c293c9da0879721
/Stage[main]//Buildbot::Slave::Instance[openafs1]/File[/home/buildslave/buildbot/openafs/info/admin]/content:
content changed '{md5}2f840fdf8acf7c334c293c9da0879721' to
'{md5}18eca080dfec8ff8fc47a54bf6a96226'
Info:
/Stage[main]//Buildbot::Slave::Instance[openafs1]/File[/home/buildslave/buildbot/openafs/info/admin]:
Scheduling refresh of Exec[buildslave start
/home/buildslave/buildbot/openafs]
Debug:
/Stage[main]//Buildbot::Slave::Instance[openafs1]/File[/home/buildslave/buildbot/openafs/info/admin]:
The container Buildbot::Slave::Instance[openafs1] will propagate my
refresh event
Debug: Exec[buildslave start
/home/buildslave/buildbot/openafs](provider=posix): Executing check
'/bin/kill -0 `/bin/cat /home/buildslave/buildbot/openafs/twistd.pid`'
Debug: Executing '/bin/kill -0 `/bin/cat
/home/buildslave/buildbot/openafs/twistd.pid`'
Debug: Exec[buildslave start
/home/buildslave/buildbot/openafs](provider=posix): Executing check
'/bin/kill -0 `/bin/cat /home/buildslave/buildbot/openafs/twistd.pid`'
Debug: Executing '/bin/kill -0 `/bin/cat
/home/buildslave/buildbot/openafs/twistd.pid`'
/Stage[main]//Buildbot::Slave::Instance[openafs1]/Exec[buildslave start
/home/buildslave/buildbot/openafs]: Triggered 'refresh' from 1 events
Debug: /Stage[main]//Buildbot::Slave::Instance[openafs1]/Exec[buildslave
start /home/buildslave/buildbot/openafs]: The container
Buildbot::Slave::Instance[openafs1] will propagate my refresh event
Debug: Buildbot::Slave::Instance[openafs1]: The container Class[Main]
will propagate my refresh event
Debug: Class[Main]: The container Stage[main] will propagate my refresh
event


Thanks,
Jason

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

Search Discussions

  • Maarten Thibaut (mthibaut) at Dec 30, 2012 at 2:45 am
    Hi,

    I believe the onlyif "wins" in this case. Splitting it up into two statements would be the right thing to do IMO.

    It would also be cleaner, since they are in effect two different cases: stopped (and in need of starting), and running (but in need of restart).

    The fact that these both run the same command is incidental. Don't think low-level, think high-level!

    Sent from my iPhone
    On 30 Dec 2012, at 03:27, "Jason Edgecombe" wrote:

    Hi,

    I'm having trouble with an exec type. I'm using an exec type to start a buildbot slave. It's a long-running pseudo-service. The exec uses the "refresh" and "onlyif". I think that the refresh command isn't running because of the onlyif attribute. I would like a refresh event to fire even if the "onlyif" attribute is in use. Any help is appreciated. Do I need to split it into two exec's (one normal and another refreshonly)?


    Here is a snippet from the type definition:
    ==============
    define buildbot::slave::instance( ..., $project_dir, ... ) {

    $path = ['/usr/local/bin','/usr/bin','/bin']
    $config_files = ["$project_dir/info/admin","$project_dir/info/host"]

    # commands to work with the buildslave
    $slave_install_command = "buildslave create-slave $project_dir $master_host_port $slave_name $slave_password"
    $slave_start_command = "buildslave start $project_dir"
    $slave_restart_command = "buildslave restart $project_dir"
    $slave_status_command = "/bin/kill -0 `/bin/cat $project_dir/twistd.pid`"

    ...snip...

    exec { $slave_start_command:
    cwd => $project_dir,
    path => $path,
    user => $user,
    group => $group,
    unless => $slave_status_command,
    refresh => $slave_restart_command,
    require => File[$config_files],
    subscribe => File[$config_files],
    }
    ======
    Here is part of the debug log:

    Info: /Stage[main]//Buildbot::Slave::Instance[openafs1]/File[/home/buildslave/buildbot/openafs/info/admin]: Filebucketed /home/buildslave/buildbot/openafs/info/ad
    min to puppet with sum 2f840fdf8acf7c334c293c9da0879721
    /Stage[main]//Buildbot::Slave::Instance[openafs1]/File[/home/buildslave/buildbot/openafs/info/admin]/content: content changed '{md5}2f840fdf8acf7c334c293c9da0879721' to '{md5}18eca080dfec8ff8fc47a54bf6a96226'
    Info: /Stage[main]//Buildbot::Slave::Instance[openafs1]/File[/home/buildslave/buildbot/openafs/info/admin]: Scheduling refresh of Exec[buildslave start /home/buildslave/buildbot/openafs]
    Debug: /Stage[main]//Buildbot::Slave::Instance[openafs1]/File[/home/buildslave/buildbot/openafs/info/admin]: The container Buildbot::Slave::Instance[openafs1] will propagate my refresh event
    Debug: Exec[buildslave start /home/buildslave/buildbot/openafs](provider=posix): Executing check '/bin/kill -0 `/bin/cat /home/buildslave/buildbot/openafs/twistd.pid`'
    Debug: Executing '/bin/kill -0 `/bin/cat /home/buildslave/buildbot/openafs/twistd.pid`'
    Debug: Exec[buildslave start /home/buildslave/buildbot/openafs](provider=posix): Executing check '/bin/kill -0 `/bin/cat /home/buildslave/buildbot/openafs/twistd.pid`'
    Debug: Executing '/bin/kill -0 `/bin/cat /home/buildslave/buildbot/openafs/twistd.pid`'
    /Stage[main]//Buildbot::Slave::Instance[openafs1]/Exec[buildslave start /home/buildslave/buildbot/openafs]: Triggered 'refresh' from 1 events
    Debug: /Stage[main]//Buildbot::Slave::Instance[openafs1]/Exec[buildslave start /home/buildslave/buildbot/openafs]: The container Buildbot::Slave::Instance[openafs1] will propagate my refresh event
    Debug: Buildbot::Slave::Instance[openafs1]: The container Class[Main] will propagate my refresh event
    Debug: Class[Main]: The container Stage[main] will propagate my refresh event


    Thanks,
    Jason

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Jason Edgecombe at Dec 30, 2012 at 3:18 am
    Thanks, that worked!
    On 12/29/2012 09:38 PM, Maarten Thibaut (mthibaut) wrote:
    Hi,

    I believe the onlyif "wins" in this case. Splitting it up into two statements would be the right thing to do IMO.

    It would also be cleaner, since they are in effect two different cases: stopped (and in need of starting), and running (but in need of restart).

    The fact that these both run the same command is incidental. Don't think low-level, think high-level!

    Sent from my iPhone
    On 30 Dec 2012, at 03:27, "Jason Edgecombe" wrote:

    Hi,

    I'm having trouble with an exec type. I'm using an exec type to start a buildbot slave. It's a long-running pseudo-service. The exec uses the "refresh" and "onlyif". I think that the refresh command isn't running because of the onlyif attribute. I would like a refresh event to fire even if the "onlyif" attribute is in use. Any help is appreciated. Do I need to split it into two exec's (one normal and another refreshonly)?


    Here is a snippet from the type definition:
    ==============
    define buildbot::slave::instance( ..., $project_dir, ... ) {

    $path = ['/usr/local/bin','/usr/bin','/bin']
    $config_files = ["$project_dir/info/admin","$project_dir/info/host"]

    # commands to work with the buildslave
    $slave_install_command = "buildslave create-slave $project_dir $master_host_port $slave_name $slave_password"
    $slave_start_command = "buildslave start $project_dir"
    $slave_restart_command = "buildslave restart $project_dir"
    $slave_status_command = "/bin/kill -0 `/bin/cat $project_dir/twistd.pid`"

    ...snip...

    exec { $slave_start_command:
    cwd => $project_dir,
    path => $path,
    user => $user,
    group => $group,
    unless => $slave_status_command,
    refresh => $slave_restart_command,
    require => File[$config_files],
    subscribe => File[$config_files],
    }
    ======
    Here is part of the debug log:

    Info: /Stage[main]//Buildbot::Slave::Instance[openafs1]/File[/home/buildslave/buildbot/openafs/info/admin]: Filebucketed /home/buildslave/buildbot/openafs/info/ad
    min to puppet with sum 2f840fdf8acf7c334c293c9da0879721
    /Stage[main]//Buildbot::Slave::Instance[openafs1]/File[/home/buildslave/buildbot/openafs/info/admin]/content: content changed '{md5}2f840fdf8acf7c334c293c9da0879721' to '{md5}18eca080dfec8ff8fc47a54bf6a96226'
    Info: /Stage[main]//Buildbot::Slave::Instance[openafs1]/File[/home/buildslave/buildbot/openafs/info/admin]: Scheduling refresh of Exec[buildslave start /home/buildslave/buildbot/openafs]
    Debug: /Stage[main]//Buildbot::Slave::Instance[openafs1]/File[/home/buildslave/buildbot/openafs/info/admin]: The container Buildbot::Slave::Instance[openafs1] will propagate my refresh event
    Debug: Exec[buildslave start /home/buildslave/buildbot/openafs](provider=posix): Executing check '/bin/kill -0 `/bin/cat /home/buildslave/buildbot/openafs/twistd.pid`'
    Debug: Executing '/bin/kill -0 `/bin/cat /home/buildslave/buildbot/openafs/twistd.pid`'
    Debug: Exec[buildslave start /home/buildslave/buildbot/openafs](provider=posix): Executing check '/bin/kill -0 `/bin/cat /home/buildslave/buildbot/openafs/twistd.pid`'
    Debug: Executing '/bin/kill -0 `/bin/cat /home/buildslave/buildbot/openafs/twistd.pid`'
    /Stage[main]//Buildbot::Slave::Instance[openafs1]/Exec[buildslave start /home/buildslave/buildbot/openafs]: Triggered 'refresh' from 1 events
    Debug: /Stage[main]//Buildbot::Slave::Instance[openafs1]/Exec[buildslave start /home/buildslave/buildbot/openafs]: The container Buildbot::Slave::Instance[openafs1] will propagate my refresh event
    Debug: Buildbot::Slave::Instance[openafs1]: The container Class[Main] will propagate my refresh event
    Debug: Class[Main]: The container Stage[main] will propagate my refresh event


    Thanks,
    Jason

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Erik Dalén at Dec 30, 2012 at 12:53 pm
    Wouldn't it be easier to use a service definition with the base provider
    and supply your start, restart & status commands?

    On 30 December 2012 03:27, Jason Edgecombe wrote:

    Hi,

    I'm having trouble with an exec type. I'm using an exec type to start a
    buildbot slave. It's a long-running pseudo-service. The exec uses the
    "refresh" and "onlyif". I think that the refresh command isn't running
    because of the onlyif attribute. I would like a refresh event to fire even
    if the "onlyif" attribute is in use. Any help is appreciated. Do I need to
    split it into two exec's (one normal and another refreshonly)?


    Here is a snippet from the type definition:
    ==============
    define buildbot::slave::instance( ..., $project_dir, ... ) {

    $path = ['/usr/local/bin','/usr/bin','**/bin']
    $config_files = ["$project_dir/info/admin","$**
    project_dir/info/host"]

    # commands to work with the buildslave
    $slave_install_command = "buildslave create-slave $project_dir
    $master_host_port $slave_name $slave_password"
    $slave_start_command = "buildslave start $project_dir"
    $slave_restart_command = "buildslave restart $project_dir"
    $slave_status_command = "/bin/kill -0 `/bin/cat
    $project_dir/twistd.pid`"

    ...snip...

    exec { $slave_start_command:
    cwd => $project_dir,
    path => $path,
    user => $user,
    group => $group,
    unless => $slave_status_command,
    refresh => $slave_restart_command,
    require => File[$config_files],
    subscribe => File[$config_files],
    }
    ======
    Here is part of the debug log:

    Info: /Stage[main]//Buildbot::Slave:**:Instance[openafs1]/File[/**
    home/buildslave/buildbot/**openafs/info/admin]: Filebucketed
    /home/buildslave/buildbot/**openafs/info/ad
    min to puppet with sum 2f840fdf8acf7c334c293c9da08797**21
    /Stage[main]//Buildbot::Slave:**:Instance[openafs1]/File[/**
    home/buildslave/buildbot/**openafs/info/admin]/content: content changed
    '{md5}**2f840fdf8acf7c334c293c9da08797**21' to '{md5}**
    18eca080dfec8ff8fc47a54bf6a962**26'
    Info: /Stage[main]//Buildbot::Slave:**:Instance[openafs1]/File[/**
    home/buildslave/buildbot/**openafs/info/admin]: Scheduling refresh of
    Exec[buildslave start /home/buildslave/buildbot/**openafs]
    Debug: /Stage[main]//Buildbot::Slave:**:Instance[openafs1]/File[/**
    home/buildslave/buildbot/**openafs/info/admin]: The container
    Buildbot::Slave::Instance[**openafs1] will propagate my refresh event
    Debug: Exec[buildslave start /home/buildslave/buildbot/**openafs](provider=posix):
    Executing check '/bin/kill -0 `/bin/cat /home/buildslave/buildbot/**
    openafs/twistd.pid`'
    Debug: Executing '/bin/kill -0 `/bin/cat /home/buildslave/buildbot/**
    openafs/twistd.pid`'
    Debug: Exec[buildslave start /home/buildslave/buildbot/**openafs](provider=posix):
    Executing check '/bin/kill -0 `/bin/cat /home/buildslave/buildbot/**
    openafs/twistd.pid`'
    Debug: Executing '/bin/kill -0 `/bin/cat /home/buildslave/buildbot/**
    openafs/twistd.pid`'
    /Stage[main]//Buildbot::Slave:**:Instance[openafs1]/Exec[**buildslave
    start /home/buildslave/buildbot/**openafs]: Triggered 'refresh' from 1
    events
    Debug: /Stage[main]//Buildbot::Slave:**:Instance[openafs1]/Exec[**buildslave
    start /home/buildslave/buildbot/**openafs]: The container
    Buildbot::Slave::Instance[**openafs1] will propagate my refresh event
    Debug: Buildbot::Slave::Instance[**openafs1]: The container Class[Main]
    will propagate my refresh event
    Debug: Class[Main]: The container Stage[main] will propagate my refresh
    event


    Thanks,
    Jason

    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@**
    googlegroups.com <puppet-users%2Bunsubscribe@googlegroups.com>.
    For more options, visit this group at http://groups.google.com/**
    group/puppet-users?hl=en<http://groups.google.com/group/puppet-users?hl=en>
    .

    --
    Erik Dalén

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Jason Edgecombe at Dec 30, 2012 at 2:47 pm

    On 12/30/2012 07:53 AM, Erik Dalén wrote:
    Wouldn't it be easier to use a service definition with the base provider
    and supply your start, restart & status commands?

    On 30 December 2012 03:27, Jason Edgecombe wrote:

    Hi,

    I'm having trouble with an exec type. I'm using an exec type to start a
    buildbot slave. It's a long-running pseudo-service. The exec uses the
    "refresh" and "onlyif". I think that the refresh command isn't running
    because of the onlyif attribute. I would like a refresh event to fire even
    if the "onlyif" attribute is in use. Any help is appreciated. Do I need to
    split it into two exec's (one normal and another refreshonly)?


    Here is a snippet from the type definition:
    ==============
    define buildbot::slave::instance( ..., $project_dir, ... ) {

    $path = ['/usr/local/bin','/usr/bin','**/bin']
    $config_files = ["$project_dir/info/admin","$**
    project_dir/info/host"]

    # commands to work with the buildslave
    $slave_install_command = "buildslave create-slave $project_dir
    $master_host_port $slave_name $slave_password"
    $slave_start_command = "buildslave start $project_dir"
    $slave_restart_command = "buildslave restart $project_dir"
    $slave_status_command = "/bin/kill -0 `/bin/cat
    $project_dir/twistd.pid`"

    ...snip...

    exec { $slave_start_command:
    cwd => $project_dir,
    path => $path,
    user => $user,
    group => $group,
    unless => $slave_status_command,
    refresh => $slave_restart_command,
    require => File[$config_files],
    subscribe => File[$config_files],
    }
    ======
    Here is part of the debug log:

    Info: /Stage[main]//Buildbot::Slave:**:Instance[openafs1]/File[/**
    home/buildslave/buildbot/**openafs/info/admin]: Filebucketed
    /home/buildslave/buildbot/**openafs/info/ad
    min to puppet with sum 2f840fdf8acf7c334c293c9da08797**21
    /Stage[main]//Buildbot::Slave:**:Instance[openafs1]/File[/**
    home/buildslave/buildbot/**openafs/info/admin]/content: content changed
    '{md5}**2f840fdf8acf7c334c293c9da08797**21' to '{md5}**
    18eca080dfec8ff8fc47a54bf6a962**26'
    Info: /Stage[main]//Buildbot::Slave:**:Instance[openafs1]/File[/**
    home/buildslave/buildbot/**openafs/info/admin]: Scheduling refresh of
    Exec[buildslave start /home/buildslave/buildbot/**openafs]
    Debug: /Stage[main]//Buildbot::Slave:**:Instance[openafs1]/File[/**
    home/buildslave/buildbot/**openafs/info/admin]: The container
    Buildbot::Slave::Instance[**openafs1] will propagate my refresh event
    Debug: Exec[buildslave start /home/buildslave/buildbot/**openafs](provider=posix):
    Executing check '/bin/kill -0 `/bin/cat /home/buildslave/buildbot/**
    openafs/twistd.pid`'
    Debug: Executing '/bin/kill -0 `/bin/cat /home/buildslave/buildbot/**
    openafs/twistd.pid`'
    Debug: Exec[buildslave start /home/buildslave/buildbot/**openafs](provider=posix):
    Executing check '/bin/kill -0 `/bin/cat /home/buildslave/buildbot/**
    openafs/twistd.pid`'
    Debug: Executing '/bin/kill -0 `/bin/cat /home/buildslave/buildbot/**
    openafs/twistd.pid`'
    /Stage[main]//Buildbot::Slave:**:Instance[openafs1]/Exec[**buildslave
    start /home/buildslave/buildbot/**openafs]: Triggered 'refresh' from 1
    events
    Debug: /Stage[main]//Buildbot::Slave:**:Instance[openafs1]/Exec[**buildslave
    start /home/buildslave/buildbot/**openafs]: The container
    Buildbot::Slave::Instance[**openafs1] will propagate my refresh event
    Debug: Buildbot::Slave::Instance[**openafs1]: The container Class[Main]
    will propagate my refresh event
    Debug: Class[Main]: The container Stage[main] will propagate my refresh
    event


    Thanks,
    Jason

    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@**
    googlegroups.com <puppet-users%2Bunsubscribe@googlegroups.com>.
    For more options, visit this group at http://groups.google.com/**
    group/puppet-users?hl=en<http://groups.google.com/group/puppet-users?hl=en>
    .
    I've thought about that. This is a basically a service, but I can have
    multiple instances of the process running with different
    configurations. As I understand, I would need to create a new service
    script for each instance.

    Jason

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Ramin K at Dec 30, 2012 at 9:30 pm

    On 12/30/2012 6:47 AM, Jason Edgecombe wrote:
    I've thought about that. This is a basically a service, but I can have
    multiple instances of the process running with different
    configurations. As I understand, I would need to create a new service
    script for each instance.

    Jason
    We manage many instances of Redis which is somewhat the same problem. I
    found it simpler to template init scripts and config files in order to
    use the native types within Puppet. The allows sudo service
    redis-server-stage restart work without having to refer to documentation
    or read what inputs the script needs. Also services start normally when
    the box comes up without having to wait for a Puppet run and makes it
    simpler to see what should be running on a box or is running.

    Ramin

    modules/redis/manifests/server.pp

    # We use ${port} for the resource declarations and ${name} for
    # path so that it should be impossible to create conflicting
    # servers using the same port and/or the same name
    define redis::server (
    $port,
    $master='localhost',
    $master_port=$port
    ) {

    include redis::params

    File {
    owner => root,
    group => redis,
    mode => '0640',
    }

    file { "redis_${port}.conf":
    ensure => present,
    path => "${redis::params::configdir}/redis_multi_${name}.conf",
    content => template('redis/redis_multi.conf.erb'),
    notify => Service["redis-server-${port}"],
    }

    file { "redis_slave_${port}.conf":
    ensure => present,
    path => "${redis::params::configdir}/slave_multi_${name}.conf",
    content => template('redis/slave_multi.conf.erb'),
    notify => Service["redis-server-${port}"],
    }

    file { "redis-server-${port}":
    ensure => present,
    path => "/etc/init.d/redis-server-${name}",
    content => template('redis/init_multi.erb'),
    notify => Service["redis-server-${port}"],
    mode => '0755',
    }

    service { "redis-server-${port}":
    ensure => running,
    enable => true,
    hasrestart => true,
    hasstatus => $redis::params::hasstatus,
    name => "redis-server-${name}",
    }

    nrpe::redis { $name: port => $port, }

    Class['redis::service'] -> Redis::Server[$name]
    }

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Jason Edgecombe at Dec 30, 2012 at 9:57 pm

    On 12/30/2012 04:30 PM, Ramin K wrote:
    On 12/30/2012 6:47 AM, Jason Edgecombe wrote:
    I've thought about that. This is a basically a service, but I can have
    multiple instances of the process running with different
    configurations. As I understand, I would need to create a new service
    script for each instance.

    Jason
    We manage many instances of Redis which is somewhat the same
    problem. I found it simpler to template init scripts and config files
    in order to use the native types within Puppet. The allows sudo
    service redis-server-stage restart work without having to refer to
    documentation or read what inputs the script needs. Also services
    start normally when the box comes up without having to wait for a
    Puppet run and makes it simpler to see what should be running on a box
    or is running.

    Ramin

    modules/redis/manifests/server.pp

    # We use ${port} for the resource declarations and ${name} for
    # path so that it should be impossible to create conflicting
    # servers using the same port and/or the same name
    define redis::server (
    $port,
    $master='localhost',
    $master_port=$port
    ) {

    include redis::params

    File {
    owner => root,
    group => redis,
    mode => '0640',
    }

    file { "redis_${port}.conf":
    ensure => present,
    path => "${redis::params::configdir}/redis_multi_${name}.conf",
    content => template('redis/redis_multi.conf.erb'),
    notify => Service["redis-server-${port}"],
    }

    file { "redis_slave_${port}.conf":
    ensure => present,
    path => "${redis::params::configdir}/slave_multi_${name}.conf",
    content => template('redis/slave_multi.conf.erb'),
    notify => Service["redis-server-${port}"],
    }

    file { "redis-server-${port}":
    ensure => present,
    path => "/etc/init.d/redis-server-${name}",
    content => template('redis/init_multi.erb'),
    notify => Service["redis-server-${port}"],
    mode => '0755',
    }

    service { "redis-server-${port}":
    ensure => running,
    enable => true,
    hasrestart => true,
    hasstatus => $redis::params::hasstatus,
    name => "redis-server-${name}",
    }

    nrpe::redis { $name: port => $port, }

    Class['redis::service'] -> Redis::Server[$name]
    }
    Hi Ramin,

    That's cool, thanks for sharing! I have the double-exec method working
    for now, and that works for a development VM, but I'll consider this for
    a future improvement.

    Thanks,
    Jason

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedDec 30, '12 at 2:34a
activeDec 30, '12 at 9:57p
posts7
users4
websitepuppetlabs.com

People

Translate

site design / logo © 2022 Grokbase