CentOS 7
Sponsored Link

Puppet : How to use [exec Resource]2015/07/22

 
This is the examples for exec resource.
It is possible to execute any commands by using exec resource, but it is not recommended because it is critical. So use this resource for specific case like when it receives events by using the refreshonly parameter.
[1] It executes "newaliases" when "/etc/aliases" is updated.
[root@dlp ~]#
vi /etc/puppet/manifests/site.pp
file { '/etc/aliases':
    ensure => file,
    owner  => 'root',
    group  => 'root',
    mode   => 644,
    source => 'puppet://dlp.srv.world/extra_files/aliases'
}

exec { 'newaliases':
    path        => ['/usr/bin', '/usr/sbin'],
    subscribe   => File['/etc/aliases'],
    refreshonly => true
}
Matched Content