Skip to content

Pillar for pseudo random hour value in cron

The value will not be random. Value will be generated from static server data, and will be in some range using python function. For range [0..2]:

 ( N % 3 )

Example:

pillars:
  linux:
    system:
      job:
        cron_job_identifier:
          command: .....
          hour: {{ __grains__['server_id'] % 3 }}
          minute: .....

Tested on 170 real values:

# ... sort | uniq -c
     56 0
     62 1
     52 2