×
Community Blog Install RunDeck Server on Alibaba Cloud

Install RunDeck Server on Alibaba Cloud

In this tutorial, you will learn how to install and configure RunDeck on an Alibaba Cloud ECS instance.

By Hitesh Jethva, Alibaba Cloud Community Blog author.

RunDeck is a free and open-source cross-platform software that can be used to automate your daily tasks in an on-premises data center or in a cloud environments. It is based on java and specially designed to create, run, share and monitor standard operating procedures on remote client nodes. You can run any tasks on number of local or remote nodes from a web-based or command-line interface. RunDeck provides role-based access control policy with support for LDAP/ActiveDirectory/SSO. RunDeck allows you to run any scripting language on remote nodes. RunDeck comes with lots of features that make it easy to scale up your scripting efforts such as, workflow building, scheduling, logging, access control and integration with external sources for node. RunDeck server connects to the configured client nodes through SSH, while a web interface allows client nodes to connect through HTTP protocols.

In this tutorial, you will learn how to install and configure RunDeck on an Alibaba Cloud Elastic Compute Service (ECS) instance that is installed with Ubuntu 16.04.

Prerequisites

Before you begin to go through this tutorial, make sure that you have the following items:

  • Two newly created Alibaba Cloud ECS instance with Ubuntu 16.04 installed.
  • A static IP address of 192.168.0.102 that is set up on the ECS instance which will be the RunDeck server and a static IP address of 192.168.0.104 that is set up on the ECS instance which will be the Rundeck client instance.
  • A root password that is set up on both instances.

    For reference, you can check out create a new ECS instance and connect to your instance. Also, once you are logged into your Ubuntu 16.04 instance, you should make sure to run the apt-get update -y command to update your base system with the latest available packages.

Configure the Hostname

The first thing you'll need to do in this tutorial is configure the hostname. To do this, you will need to setup hostname on Rundeck server instance. To do this, first you can do this by running the following command:

hostnamectl set-hostname node1.rundeck.com

Next, add the hostname and IP address to /etc/hosts file with the nano /etc/hosts command. And then, add the following lines:

192.168.0.102 node1.rundeck.com

Save and close the file when you are finished.

Install Java

Rundeck requires Java 8 installed on your server instance. By default, Java 8 is not available in the Ubuntu 16.04 server default repository, and so you'll need to add it. You add the Java repository with the following command:

add-apt-repository ppa:webupd8team/java

Next, update the repository and install Java 8 using the apt-get install oracle-java8-installer -y command. Then, after installing Java, you can check the Java version by running the java -version command. The output of this command will look something like this:

java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)

Install and Configure Rundeck

For this part now, the first thing you will need to do is download the Rundeck stable version from their websites. You can download it with the following command:

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

Once the download is complete, install the Rundeck with the following command:

dpkg -i rundeck-2.6.7-1-GA.deb

Next, you should see the following output:

Selecting previously unselected package rundeck.
(Reading database ... 86792 files and directories currently installed.)
Preparing to unpack rundeck_3.0.9.20181127-1.201811291844_all.deb ...
Unpacking rundeck (3.0.9.20181127-1.201811291844) ...
Setting up rundeck (3.0.9.20181127-1.201811291844) ...
Adding group rundeck....done
Adding system user rundeck....done
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for systemd (229-4ubuntu11) ...

The main configuration file of Rundeck is located at /etc/rundeck/ directory. First, you will need to edit /etc/rundeck/framework.properties file to customize Rundeck:

nano /etc/rundeck/framework.properties

Change the following lines:

framework.server.name = node1.rundeck.com
framework.server.hostname = node1.rundeck.com
framework.server.port = 4440
framework.server.url = http://192.168.0.102:4440
# Username/password used by CLI tools.
framework.server.username = admin
framework.server.password = admin

Save and close the file. Then, open /etc/rundeck/rundeck-config.properties file and provide your Rundeck server URL. You can do so with the nano /etc/rundeck/rundeck-config.properties command. Then, you'll want to change the following line:

grails.serverURL=http://192.168.0.102:4440

Save and close the file when you are finished. Next, start Rundeck service and enable it to start on boot time with the following command:

systemctl start rundeckd
systemctl enable rundeckd

Next, check the status of Rundeck service with the systemctl status rundeckd command. The output should look something like this:

● rundeckd.service - LSB: rundeck job automation console
   Loaded: loaded (/etc/init.d/rundeckd; bad; vendor preset: enabled)
   Active: active (running) since Tue 2018-12-18 21:28:23 IST; 7s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 21943 ExecStop=/etc/init.d/rundeckd stop (code=exited, status=0/SUCCESS)
  Process: 22007 ExecStart=/etc/init.d/rundeckd start (code=exited, status=0/SUCCESS)
 Main PID: 22026 (java)
    Tasks: 10
   Memory: 67.1M
      CPU: 3.632s
   CGroup: /system.slice/rundeckd.service
           └─22026 java -Drundeck.jaaslogin=true -Djava.security.auth.login.config=/etc/rundeck/jaas-loginmodule.conf -Dloginmodule.name=RDprop

Dec 18 21:28:22 node1.rundeck.com systemd[1]: rundeckd.service: Main process exited, code=exited, status=143/n/a
Dec 18 21:28:22 node1.rundeck.com systemd[1]: Stopped LSB: rundeck job automation console.
Dec 18 21:28:22 node1.rundeck.com systemd[1]: rundeckd.service: Unit entered failed state.
Dec 18 21:28:22 node1.rundeck.com systemd[1]: rundeckd.service: Failed with result 'exit-code'.
Dec 18 21:28:22 node1.rundeck.com systemd[1]: Starting LSB: rundeck job automation console...
Dec 18 21:28:23 node1.rundeck.com rundeckd[22007]:  * Starting rundeckd
Dec 18 21:28:23 node1.rundeck.com rundeckd[22007]:    ...done.
Dec 18 21:28:23 node1.rundeck.com systemd[1]: Started LSB: rundeck job automation console.

Access the Rundeck Web Interface

Rundeck is now running and listening on port 4440, so now it's time to access Rundeck web interface. So to do this follow these steps. First, open your web browser and type the address http://192.168.0.102:4440. You will be redirected to the Rundeck login page:

1

Now, provide default username and password as admin/admin and click on the Login button. You should see the following page:

2

Now, click on New Project button. You should see the following page:

3

4

5

Now, provide all the required details like, project name, description, default node executer and default node copier. Then, click on the Create button. You should see the following page:

6

Now, go to the Nodes menu and click on the All Nodes button. You should see your Rundeck server node in the following page:

7

Add a Client Node to Rundeck

Next, you will need to add Client node to the Rundeck server. You can do this by editing /var/rundeck/projects/Myproject/etc/resources.xml on the Rundeck server instance.

nano /var/rundeck/projects/Myproject/etc/resources.xml

And then you'll want to add the following line between section:

<node name="client" description="Client Node" tags="" hostname="192.168.0.104" osArch="amd64" osFamily="unix" osName="Linux" osVersion="4.4.0-45-generic" username="root" ssh-key-storage-path="keys/Myproject/client.key"/>

Save and close the file, when you are finished.

hostname : It defines the IP address of Client node.
username : It defines the username of Client node.
ssh-key-storage-path : It defines the path of SSH key file, which we will create later.

On the Rundeck dashboard go to the Nodes menu and click on the All Nodes button. You should see the newly added Client node in the following image:

8

Create and Add an SSH Key

Next, you will need to create an SSH keypair on the Client node and add it to the Rundeck server instance.

First, log in to the Client node and run the following command to create an SSH keypair:

ssh-keygen 

Then, the output will look like this:

Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
48:49:e4:f6:9e:a8:b3:bd:3e:74:fa:bc:92:0d:1d:58 root@rancher-client
The key's randomart image is:
+--[ RSA 2048]----+
|     .o          |
|     o .E        |
|      =o         |
|     o.o.        |
|      ..S.       |
|      ooo.       |
|     ..*o        |
|    .o=..        |
|    o++=+.       |
+-----------------+

The above command will generate two files id_rsa and id_rsa.pub in /root/.ssh directory. After this, you will need to copy the content of id_rsa.pub file to the authorized_keys file. Then, to see the content of id_rsa.pub file, run the cat .ssh/id_rsa.pub command. The output of this command will be like what you see below:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6P+RXD3njzeOusn6NcAG2ieRH4TBQPS1+eEGUBp7o6I1FoWv5hekKwaxHQ1IvEYC111KDYcsAfJ4GI4szda+ZumHFOFQNfkdSfYCzZ3Z0IW4hVcRLLw2GjHauzyQfrL93b6wPJ+lnp5ro7TAkm/pSHhoeHvWjAUAzDkitO40RYVizPUgy6lkmJMjA0AOPCyz0tyU3BlaXvuASVpeffvEv8P2zWlWQtLdnRFxFlstZMvSLa96rC6gndApdsNgsWxWVuU13To0LrMkOmsUTAHi9nGI4Wdx8VlGbi+jgZ0q83u8pUdd9aeI3EVCT3pZsEB/vG812zj3DQsmeIm5wwzmB root@client

Next, copy the above content and paste it in the authorized_keys file as shown below:

nano .ssh/authorized_keys

Add the following line:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6P+RXD3njzeOusn6NcAG2ieRH4TBQPS1+eEGUBp7o6I1FoWv5hekKwaxHQ1IvEYC111KDYcsAfJ4GI4szda+ZumHFOFQNfkdSfYCzZ3Z0IW4hVcRLLw2GjHauzyQfrL93b6wPJ+lnp5ro7TAkm/pSHhoeHvWjAUAzDkitO40RYVizPUgy6lkmJMjA0AOPCyz0tyU3BlaXvuASVpeffvEv8P2zWlWQtLdnRFxFlstZMvSLa96rC6gndApdsNgsWxWVuU13To0LrMkOmsUTAHi9nGI4Wdx8VlGbi+jgZ0q83u8pUdd9aeI3EVCT3pZsEB/vG812zj3DQsmeIm5wwzmB root@client

Next, you will need to add content of id_rsa file on the Rundeck server. To see the content of id_rsa file, run the following command:

cat .ssh/id_rsa
-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEAuj/kVw95483jrrJ+jXABtonkR+EwUD0tfnhBlAae6OiNRaFr
+YXpCsGsR0NSLxGAtddSg2HLAHyeBiOLM3WvmbphxThUDX5HUn2As2d2dCFuIVXE
Sy8Nhox2rs8kH6y/d2+sDyfpZ6ea6O0wJJv6Uh4aHh71owFAMw5IrTuNEWFYsz1I
MupZJiTIwNADjwss9LclNwZWl77gElaXn37xL/D9s1pVkLS3Z0RcRZbLWTL0i2ve
qwuoJ3QKXbDYLFsVlblNd06NC6zJDprFEwB4vZxiOFncfFZRm4vo4GdKvN7vKVHX
fWniNxFQk96WbBAf7xvNds49w0LJniJucMM5gQIDAQABAoIBABKjHhhQJiRTj/sF
RYCluqYnej5vHESLOqgzJGzJlNE9pBVZp9JaQg2ff7vJ0sl++OA5Ybpf6M5tqep3
WBCYMDAz5GC12ENZZY2tnVlWexX32mtfh7r2RGY4XA/2DmlVAfvTouYJWmPS879n
LLAdI5lgBcEJ3A6pq2Dwhvk+wkkAxwIQvu6BpBF+f3Vf+vF0uyLuWtFDDAzruOmx
fck7NqVefJ/BqyYs373/V6F33DmNfYAYwqkRw6k8dKmkc3IwhchPD4xsBPkeU5d0
uU6++vekmeAN8kCbAsOECxMyFGGV7fxthD5OcFo7h/pRAqicVFXdXO6pF/CTQ1Mj
P0fc5NkCgYEA4sbnzkknl/d3Tha5eYaQ9jYpX+ZOjhkuzePXFHD+gVAX9k9znkoZ
E22fzx98pg11Tm11UJEjsqXh2nltpZ0qhI+E7QrzfsIETZtxc3dim2ErgeXBKQYL
GZXXABmahHY2qbI3bXOhtctpQbF8lXMty5AY1sFFF/Yxf5j+I5znVrMCgYEA0kAJ
jP31jrQA5szGMKl5zOQgZqDTXqEUaRlnGJWYuO13XD7iJwD3YQhvKgsH44DrW7rg
+j0FrRgDKXxh6mUwGWJ0FuYqcLFdqTV4xFEzxnYkxjiG93EXezjkCsSRnK0ni99t
dQ2orz50/Y7ieSQFCPIItcB3AupgOXP7haal6PsCgYEA4ZG/2WziuUIppb7s1niH
kJ/nH8DRun5KE/nhYi/St4WXkCUPeA90SeLs5vUG45TXbh9qZa04uOZPdST7b5SZ
SioHqlEOSrNp3FgVzSifKLbKs/Z43/lm6RgmN69AByoezUS75V7zJwUhuXp11aIv
lx/J1TOBKoh0S9s+TuYvJgkCgYEAkT9SGcgcSxCJiuiuhlGeZnC2/Y9fVoFbU1wM
QAyg7CiJC/4ZSC6/t5YXDel+8qlObxmEcPuVH0Z2cMOP9VkgSHkej+9EJIQzm0Do
hF9AsHtP3myQuQK04RilWdcAbUemCVg6CuJ7xU0Vj1GVnXDH1a03XTBwR2BZR3eb
rHI7Ld8CgYEAsmjOqbfl1xx9ELaziPP0c7XvdnQIXva0bRGuK5iXWbGWzF5i6d05
6VtRzloWWKcS412Y/b2bC3b287bdihBDUHEBIBMSzkSbKLR/70M7s1aibb9l75Yb
aby7wP2IlW3eTnIRRu0ABOR+vGERSbHW1W38maFyUYMJYbAQuaCs4J4=
-----END RSA PRIVATE KEY-----

On the Rundeck dashboard, click on the Setting Icon > Key Storage. You should see the following page:

9

Now, click on the Add or Upload a Key button. You should see the following page:

10

Now, paste the content of id_rsa file inside the Enter text box, provide storage path and key name. Then, click on the Save button. You should see the following page:

11

Now, click on the Rundeck home button. You should see the following page:

12

Now, click on the Myproject button. You should see the following page:

13

Now, click on the Commands menu, type client in the Nodes box and click on the Search button. You should see the following page:

14

Now, type free -m in the Command box and click on the Run on 1 Node button. You should see the free memory on the Client node in the following page:

15

Now, again type uptime in the Command box and click on the Run on 1 Node button. You should see the system uptime of the Client node in the following image:

16

0 0 0
Share on

Alibaba Clouder

2,603 posts | 747 followers

You may also like

Comments