1

So I have see the resource schedule in puppet. But it's not clear if I can have a complex schedule. If I want to install packages only Monday 10PM-3AM or Tuesday 10AM-Noon, unless a (external fact provided by another system) is true, what might be the best way to do that? Do I need to create 2 schedule resources, 2 package resources each with a different schedule, but otherwise the same (maybe a define helps here?) as well as a package resource without a schedule wrapped in an if $fact == true statement?

I'm looking at doing the if statements, and that will handle the flag I'm talking about. Can I pass 2 or more schedules though to a resource?

I.e.

 schedule { 'monday_updates':
  range   => '22:00 - 03:00',
  weekday => 'Monday',
}
schedule { 'tuesday_updates':
  range   => '10:00 - 12:00',
  weekday => 'Tuesday',
}

$updates = ['monday_updates','tuesday_updates']
package { $additionalwindowspackages:
        ensure   => latest,
        provider => 'chocolatey',
        schedule => $updates,
      }

1 Answer 1

0

No. You want to go for a structure like

case $schedule_control_fact {
    'some_value': {
       $range = X
       $day = Y
    },
    default: {
       $range = Z
       $day   = A
    }
}

schedule { 'package-schedule':
    range => $range,
    weekday => $day,
}

Then just use package-schedule throughout.

2
  • So I'm switching on what fact though? I'm trying to basically have the package apply during 2 different maintenance windows... Like an OR.
    – jmp242
    Jun 5, 2015 at 15:37
  • Ah, it just clicked for me what your specific problem is (superimposing alternate schedules). Tough. You could use the above construct and create a crude $weekday fact. The master can then use a different schedule for each day of the week. Jun 7, 2015 at 17:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .