Conditional Job Execution

1,395 views
Skip to first unread message

Jonathan Dunn

unread,
Aug 7, 2012, 11:35:51 AM8/7/12
to rundeck...@googlegroups.com
I have a workflow that has an "ENV" option.  The value of this option is either QA or PROD.  The jobs that make up this workflow read these values in from a .json file.

I'd like one of the jobs in the workflow to run on a remote node, but the node it would run on would be different, depending on the value of ENV. 

My nodes are all listed in a resources.xml file, and I use tags to label them, i.e. tags="QA" or tags="PROD".

The job editing page says that regular expressions can be used in the Dispatch to Nodes subsection.  Can the value of my variable be used?  In other words, can I Dispatch to Nodes -> Include -> Tags: ${options.ENV}?  This would allow this job to run on different remote nodes, depending on the value supplied to ENV.


Greg Schueler

unread,
Aug 7, 2012, 12:45:05 PM8/7/12
to rundeck...@googlegroups.com
Hi Jonathan,
yes you can set the node dispatch filters to include references to the job option values, such as ${option.ENV}.  Since this value isn't set until you execute the job, if you do this then the Job can't display the predicted set of nodes.

Jeffrey Hulten

unread,
Aug 7, 2012, 3:59:10 PM8/7/12
to rundeck...@googlegroups.com
Alternately, if you only have two environments, you can set up two folders with different instances of the same job and use the node filter to select the nodes for that environment. This will allow you to set up access roles separately for PROD and QA.

--
Jeffrey Hulten
Principal Consultant at Automated Labs, LLC
je...@automatedlabs.com 206-853-5216
Schedule a Meeting @ https://tungle.me/jeffreyhulten
Skype: jeffhulten
signature.asc

Marco Boschetti

unread,
Jun 24, 2013, 9:05:42 AM6/24/13
to rundeck...@googlegroups.com
Hi,
in your opinion is there a way to implement this kind of mechanism using the list of nodes provided by chef-rundeck plugin?

My use case is:
Preconditions: 
- I have a list of nodes managed by Chef server
- Every node is "tagged" with Chef environment ("QA", "PROD", etc)
- The chef-rundeck plugin provides the nodes as resource model
Scenario's steps:
- User starts the job execution
- User selects the environment (and possibly the single associated nodes)
- Rundeck dispatches deploy script (chef-client commands) on selected nodes

Any suggestions on how can I realize this scenario without workflow duplication?

Thanks
Marco 

Moses Lei

unread,
Jun 24, 2013, 9:37:21 AM6/24/13
to rundeck...@googlegroups.com
This is doable (use an ${option.env} in tags), but prevents you from limiting the environments a user can touch, since the allowed environments list would be the same for everyone. I generally have a reference job exported to XML and make several copies in different job folders, and limit access by folder.

--
Moses Lei
Principal, Village Chime LLC
mobile: +1 703 901 5969 | skype: moseslei | yahoo: moseslei


--
You received this message because you are subscribed to the Google Groups "rundeck-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rundeck-discu...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reigner S. Yrastorza

unread,
Jun 24, 2013, 7:08:39 PM6/24/13
to rundeck...@googlegroups.com
Hi,

How do you change rundeck default email sender address?
Currently it is using "rundeck-server@localhost".

Additional Info:
- Rundeck Version: rundeck-1.5.3-1.2.GA.noarch
- Uses localhost postfix to send the email notification
- Already tried various ways by modifying framework.properties and rundeck-config.properties but to no avail.


framework.properties -
#
# Email settings
#
# recipient addresses to send email (comma separated)
framework.email.tolist = root
# email address appearing in message "from" field
framework.email.from = run...@rundeck.anaplan.com
# email address replies should go
framework.email.replyto = do-not-reply
# The rdeck email relay host. must be a functioning smtp relay server
framework.email.mailhost = rundeck.anaplan.com
framework.email.mailport = 25
# User/pass info if the smtp server requires it
framework.email.user =
framework.email.password =
framework.email.ssl = false
framework.email.failonerror = true



Thanks,
Reigner

Greg Schueler

unread,
Jun 24, 2013, 7:34:46 PM6/24/13
to rundeck...@googlegroups.com

Use grails.mail.default.from within your rundeck-config


http://rundeck.org/docs/administration/configuration.html#notification-email-settings




--
Greg Schueler
--

Reigner S. Yrastorza

unread,
Jun 25, 2013, 5:48:25 PM6/25/13
to rundeck...@googlegroups.com
Have figured it out..

Just need to edit rundeck-config.properties as -
grails.mail.host=ec2-rundeck.anaplan.com
grails.mail.port=25
grails.mail.default.from=rundeck...@rundeck.anaplan.com

then restart rundeck.


--
Reigner S. Yrastorza
Reply all
Reply to author
Forward
0 new messages