What is Rundeck and how to create a Job using it

0
389
What is rundeck

Rundeck is an open source automation service with a web console, command line tools and a WebAPI. It lets you easily run automation tasks across a set of nodes.

RunDeck is cross-platform open source software that helps you automate ad-hoc and routine procedures in data center or cloud environments. RunDeck allows you to run tasks on any number of nodes from a web-based or command-line interface. RunDeck also includes other features that make it easy to scale up your scripting efforts including: access control, workflow building, scheduling, logging, and integration with external sources for node and option data.

Preliminary notes

As Rundeck uses ssh to connect to remote systems, you must have an account on those systems with a sudo right (if necessary).
We suppose the username is rundeck with password rundeck.

Rundeck is written in java, so we need to install the JDK:

# dpkg --add-architecture i386
# apt-get install openjdk-7-jdk

Downloading Rundeck

At this time, the last version is 2.8.2. To download the software, use the following command:

# wget http://dl.bintray.com/rundeck/rundeck-deb/rundeck-2.8.2-1-GA.deb

Install the package :

# dpkg -i ./rundeck-2.8.2-1-GA.deb

Configure Rundeck Sever

Configure the package:

Edit the files /etc/rundeck/framework.properties and /etc/rundeck/rundeck-config.properties and change the line:

grails.serverURL=http://localhost:4440

to:

grails.serverURL=http://your_server:4440

where your_server is the ip address or FQDN of your rundeck server.

Now start Rundeck, by running the following command:

# /etc/init.d/rundeckd start

and wait for a minute before connecting.

Launch your favorite web browser and go to: http://your_server:4440

Use Rundeck Sever

To connect to the GUI, use the username and password: admin / admin.

Create a project

For the first connection, click on the link “New project” to add a project.
You have to provide at least a project name (without spaces)

rundeck new project
In the “Resource Model source” section, click the “Edit” button and choose “Require file exists“. Then click on “Save

In the “Default Node Executor” section, I choose “password” for SSH AUthentication (it is however possible to use a pair of keys for better security) Click on “Create” to create the project.

Create a job

Now you are ready to create your first job. This job consists of an ssh connection to launch a remote command.
Click on “Create a new job” and choose your job name (without spaces).
Now we need a password and a sudo password to connect and launch a command.

rundeck jobClick “Add an option.

In the option name, specify sshPassword1 and in default value specify your password (here we will use rundeck)
In the Input type, choose “Secure Remote authentication” and change “Required” from No to Yes as it is a mandatory field.
Repeat the operation with sudoPassword2 and the value rundeck.

Click “Save

In the section “Add a step“, choose “Command
Provide your command in the Command field . I choose to update my server:

sudo "apt-get update"

Click on “Save” then “Create” to create the job.

To apply this job to our remote systems (called nodes), we need to edit the node file:

# vi /var/rundeck/projects/your_project_name/etc/resources.xml

Modify the line beginning with ssh-authentication=”password” ssh-password-option=”option.sshPassword1″ sudo-command-enabled=”true” sudo-password-option=”option.sudoPassword2″.

Now go back to your GUI and launch the job!

NO COMMENTS