Fig: Rundeck functionality Overview

Rundeck: Open Source Automation — Part 1

Rundeck is runbook automation. Give anyone self-service access to the operations capabilities that previously only your subject matter experts could perform.

Popular use cases include incident management, service requests, business continuity, or just spreading the operational load among your colleagues.

This blog will be on setting up the Rundeck in your modern distributed or centralized environment, to help you monitor virtual machines or execute some task remotely. In the first part of the series, I will be covering the following scenario.
1. Setting up Rundeck on VM
2. Creating a Rundeck Project
3. Creating a New Job
4. Executing A Job on Local VM
5. Adding Remote VMs as a Node
6. Executing a Job on Remote VMs

Note: for this blog, I will be taking a Linux VMs with CentOS 7 installed on it.

Setting up Rundeck on VM

I will be using the open-source version of Rundeck.

The following commands will install the Rundeck on your VM.
1. sudo rpm -Uvh http://repo.rundeck.org/latest.rpm
2. sudo yum install rundeck java

After the installation we need to start it by running the below command, also to verify it started successfully & we can tail the logs.
1. sudo service rundeckd start
2. tail -f /var/log/rundeck/service.log

To access the Rundeck UI we need to access this on its default port 4440. Open any browser and access the UI by the following URL
http://<ip-of-vm>:4440/user/login
If Rundeck doesn’t load then you might wish to connect with your infra guys for firewall setup in my case I can disable the VM firewall by running the following command
sudo systemctl stop firewalld

Rundeck: Login Screen

The default username and password for Rundeck is admin/admin. Now we should be able to login to Rundeck.

Note: It might happen that you are able to launch Rundeck but not able to login with admin credentials. In such a case follow the below steps to troubleshoot the issues.
1) $ cd to /etc/rundeck
2) Open rundeck-config.properties
3) Update grails.serverURL feild from http://localhost:4440 to
http://<ip-of-VM>:4440
4) Save the file and restart the rundeck by following commands.
$ service rundeckd restart

Creating Rundeck Projects

  1. login to Rundeck
  2. Click on a new project under the project on the left top corner of the webpage.

3. Enter the details on a Create a new Project Screen and click on Create and your project is created. To explain other functionality during the blogs I have created a project as Test_Project in Rundeck.

Creating a New Job

  1. Click on a project we created in the above steps and under the project on the left top corner of the webpage.
  2. On right, you will see the create a job button, click on it.
  3. On Create New Job Screen enter the job name and description and under the workflow section, you can add your scripts or command you wish to execute on your VM.
  4. Now save your workflow and create your job.

Executing A Job on Local VM

  1. Now we have created a job in the above steps we need to run this job. On the job page, you will see a green button Run Job Now , just click on it.
  2. Once the Job is executed you will see the results of execution similar to the below screen. Please note output will be as your script.

3. As we have not added any remote VMs IP so this job is getting executed remotely on our local VM where the Rundeck is installed.

Adding Remote VMs as a Node

  1. To execute the jobs on remote VMs, Rundeck provides a concept of nodes. Each remote VM is treated as a node in Rundeck.
  2. We need to first add all remote VMs as a node in Rundeck and then we can execute the jobs as per our requirements.
  3. To add nodes click on Project setting then Edit nodes .
  4. In the Sources tab click on Add a new source node . On the pop up select the file and enter details as per the below screen. Here I am choosing the resource file to be created inside our project directory.

5. Now save the screen and sources tab and your node will be created.

6. Now navigate to the edit tab and modify the file that just got created. you will see similar to the below screen.

7. You can click on modify the file and you will see a default entry of node in the file. I am sharing the node entry which I will be using during our discussion.

<node name="remote-appname-VM-1" description="Rundeck server node remote-appname-VM-1" tags="remote-appname" hostname="<remote-vm-ip>" username="<remote-vm-ssh-username>" ssh-keypath="/var/lib/rundeck/.ssh/id_rsa" />

Please note that here we are using ssh based authentication with remote VMs. To learn more about that you can refer following links.

8. This way you can multiple entries in the same file or create multiple files. let's save the file and find out where it gets reflected.

Executing a Job on Remote VMs

  1. As we have added nodes in our project, so our job is ready to execute remote application VMs.
  2. To Edit the job and navigate to Jobs under the project and click on jobs we created and now click on Actions > Edit this Job
  3. Go to Node tab and under the tab select radio butting Dispatch to nodes , now you will observe the below screens.

4. Select the Node filter as Select All Nodes , then under Matched nodes you will observe the entry to your remote VMs. now you can select multiple or single nodes to execute the jobs as per your requirements.
Note: selection by Tag name allows you to select multiple VMs for the same job having the same tag name as shown below.

5. Now click on the tag name (+) sign and Vms with the same tag name will get selected, below is a confirmation screen.

6. Now save the job and execute it. Hurray, You have achieved it. :-)

7. You can also schedule the jobs in Rundeck just like corn job scheduling. To do this you can edit the jobs and navigate to Scheduled tab and select Schedule to run repeatedly? as yes and then provide the details and timezone.

I hope this blog was useful to you. Please leave comments or send me an email if you think I missed any important details or if you have any other questions or feedback about this topic.

References:

Computer Science Engineer with a passion for Machine Learning, AI & Data Visualization. Transforming world with data.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store