Ask Your Question
0

mcollective puppetral cron resource

asked 2016-01-05 15:41:59 -0500

jsemerica gravatar image

updated 2016-03-10 18:05:51 -0500

Hi all,

I'm trying to use mcollective and the puppetral to list out a cron resource, it seems to have no trouble doing it for root's cronjobs.

$ mco rpc puppetral find type=cron title='pe-mcollective-metadata'

or

$ mco rpc puppetral search type=cron

 hostname1
   Result: [{"type"=>"Cron",
             "title"=>"pe-mcollective-metadata",
             "tags"=>["cron", "pe-mcollective-metadata"],
             "exported"=>false,
             "parameters"=>
              {:ensure=>:present,
               :command=>
                "/opt/puppet/sbin/refresh-mcollective-metadata 2>&1 >>/var/log/pe-mcollective/mcollective-metadata-cron.log",
               :minute=>["0", "15", "30", "45"],
               :user=>"root",
               :target=>"root"}}]

Is it possible to find this information for another user? The cronjobs I'm interested in are in our application ID's crontab and it looks like the only information it's looking at is for root.

Any help is appreciated, thanks!

UPDATE

After opening a support case, this appears to be a bug in 3.8 and is fixed in 2015.3.X

https://tickets.puppetlabs.com/browse...

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-01-05 16:48:58 -0500

GregLarkin gravatar image

It appears that the command will look across all user crontabs as long as you know the name of the cron resource you want. To test this, I ran puppet apply on this code:

cron { foo:
  command => "/bin/true",
  user    => peadmin,
  hour    => 2,
  minute  => 0
}

Then I ran the following command and received this output:

peadmin@master:~$ mco rpc puppetral find type=cron title=foo
Discovering hosts using the mc method for 2 second(s) .... 1

 * [ ==========================================================> ] 1 / 1


master.localdomain
     Exported: false
      Managed: unknown
   Parameters: {"ensure"=>"present",
                "command"=>"/bin/true",
                "minute"=>["0"],
                "hour"=>["2"],
                "user"=>"peadmin",
                "target"=>"peadmin"}
         Tags: ["cron", "foo"]
        Title: foo
         Type: Cron



Finished processing 1 / 1 hosts in 163.38 ms

Trying to constrain the output to a specific user with the additional argument user=root doesn't have an effect and probably means the mco agent can't handle arbitrary resource attributes as part of its input.

edit flag offensive delete link more

Comments

Interesting, in my environment unless it's under root's crontab, it comes back as ensure absent. I may have to open a support ticket and see if I'm doing anything wrong.

jsemerica gravatar imagejsemerica ( 2016-01-05 17:21:49 -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: 2016-01-05 15:41:59 -0500

Seen: 297 times

Last updated: Mar 10 '16