0

I have several crontabs defined in a pp file, e.g:

cron { 'puppet-cron1':
    ensure  => present,
    command => "cat /etc/issue",
    user    => root,
    minute  => '*/30',
}
cron { 'puppet-cron2':
    ensure  => present,
    command => "cat /etc/issue",
    user    => www-data,
    minute  => '*/30',
}

How do I list all cronjobs created by puppet on a system?

I tried puppet ressource cron, which lists only the root cronjob:

cron { 'puppet-cron1':
  ensure  => 'present',
  command => 'cat /etc/issue',
  minute  => ['*/30'],
  target  => 'root',
  user    => 'root',
}
M. Glatki
  • 1,964
  • 1
  • 17
  • 33

1 Answers1

1

You can use the puppet resource command on the system in question, like this:

# puppet resource cron

This should show you all cron resources Puppet manages on that system.

daff
  • 4,809
  • 2
  • 28
  • 27
  • This is the result of the command. `cron { 'puppet-cron1': ensure => 'present', command => 'cat /etc/issue', minute => ['*/30'], target => 'root', user => 'root', }` It only shows the root cronjob, not the one for www-data. I have verified that the www-data cronjob does indeed exist. – M. Glatki May 24 '16 at 11:19
  • 1
    Indeed, running `puppet resource cron` as root only shows the Puppet-managed cronjobs for the user `root`. You can run `sudo -u www-data puppet resource cron` to see the Puppet-managed cronjobs for the `www-data` user. Not sure if there is a way to list all Puppet resources for all users without doing some shell scripting. – daff May 24 '16 at 12:05