How to create a job on Rundeck
Rundeck is an incredibly powerful tool for administrators. Instead of having to log into each and every machine in your data center, you can log into the Rundeck Dashboard and run commands on your servers (individually or by groups).
But Rundeck has an even better way of doing things. Instead of running those individual commands, you can create jobs to run on those servers. A job can contain any number of steps (from commands, scripts, job references, Ansible playbooks, data node steps, and more), which can:
I want to walk you through the process of creating a job on Rundeck. I'll demonstrate how to create a job that will schedule the process of updating and upgrading Ubuntu Servers.
SEE: Executive's guide to the software defined data center (TechRepublic download)
What you need
I will assume you already have Rundeck up and running and nodes connected which, for the purpose of this example, will be Ubuntu Servers (See: How to install Rundeck local and remote services controller on Ubuntu 18.04).
With those bits in place, let's configure.
Creating the job
First, log into your Rundeck server. Once authenticated, click on the project (in the sidebar) you want associated with the job. In the Job Actions dropdown (Figure A), click New Job.
Give the job a name and a description (Figure B).
Next, we need to select the nodes for the job (SEE: How to Add Remote Nodes to Rundeck). This will, of course, assume you already have servers associated with a node. Scroll down to the Nodes section and check Dispatch to Nodes (Figure C). Click the Node Filter dropdown and select the node you want to associate with the job, followed by Search. All nodes matching that filter should immediately populate the Matched Nodes field.
Since we're crafting a fairly standard job, scroll down to the Workflow section and click the Add a step button. From the list of possible steps, click the Command entry (Figure D).
For our first step, we're going to add the command sudo apt-get update. Enter that in the Command section (Figure E), and then type Update Apt for the label.
Click the Save button and the step is ready. Repeat this process, adding sudo apt-get upgrade -y as the next step.
Next, we want to schedule the job. Scroll down until you see Schedule to run repeatedly. Click Yes and then select the time and frequency for the scheduled job (Figure F).
Make sure to:
Scroll down to the bottom of the job creation page and click Save.
Congratulations, your first job has been created. With this in place, the Ubuntu servers associated with the job will all be updated and upgraded at the specified time and frequency. No more having to log into those machines individually to take care of the task.
All in the details
Make sure to look into the details of your jobs. There are quite a number of options and features available, which can transform a fairly basic job into the realms of the highly complex. With the help of Rundeck, your admin job just became more efficient.