Ask Your Question

Is there a way to have resources not change/set an attribute, which has a default, at all?

asked 2017-09-01 13:20:59 -0600

JDFlanigan gravatar image

The Problem: I'm trying to convince puppet to stop turning on all of my scheduled tasks (which all don't specify the enabled attribute), and just let me manage these by hand. I have several scheduled_tasks running on Windows servers in a passive datacenter. I would like to not specify an enabled attribute (as I also have active datacenters where these should be running), and just manage turning these on and off by hand.

Already Tried: I've considered setting the attributes for each datacenter via hiera, but the reality is that this makes failovers and switches more complicated than necessary. I don't want to change my puppet code every time that needs to happen. I also can't shut-off the puppet-agent runs. I need to maintain the integrity of our rolling deployment system.

Providers? I've read a little about providers, seems like I can handle the behavior there. However, I'm having a hard time figuring out where there is (if any) documentation that explains how to use them to override specific resource properties.

Notify/Subscribe: I've considered using notify/subscribe to only set the triggers to enabled on creation. I'm not thinking this is the right solution, because it's not one resource subscribing to/notifying another, it's properties being set on a single resource. If there's some magical way of doing this or something similar, I'd love to know.

Bottom-line: I just need puppet to create disabled tasks, and let me turn them on/off without changing the state in subsequent runs.

edit retag flag offensive close merge delete


The current implementation of type/scheduled_task.rb and provider/scheduled_task/win32_taskscheduler.rb doesn't look like it allows that. A (rather difficult) approach would be, to gather (custom) facts like “is schedule_task x enabled?” and use that variable where you specify the enabled attribute.

Kai Burghardt gravatar imageKai Burghardt ( 2017-09-05 15:52:16 -0600 )edit

1 Answer

Sort by » oldest newest most voted

answered 2017-09-05 12:29:59 -0600

eric aldinger gravatar image

updated 2017-09-05 12:36:30 -0600

We migrated off of Windows before I had Puppet. We used to manage tasks by importing and exporting tasks in XML using their own BoxStarter package. Similarly, you could make your own Puppet module that manged Windows tasks the same way. There would be one file resource and one exec resource per task. If the resource should not be managed consistently by Puppet this seems like a better deployment model.

Another idea is to always deploy disabled, and have an exec that enables tasks based on hiera environment settings per data center.

A harder better practice is to have the tasks be identical in lower and upper environments, and have the task be data center aware.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2017-09-01 13:20:59 -0600

Seen: 35 times

Last updated: Sep 05 '17