Rundeck Community Edition
Install Rundeck Community Edition as an executable war on Ubuntu
- Install Java if your Ubuntu doesn't have
- Download Rundeck Community Edition executable war file.
https://www.rundeck.com/open-source/download
- Define RDECK_BASE environment variable to the location of the install. Example you're using jenkins user to run Rundeck
# Log in as jenkins user
export RDECK_BASE=$HOME/rundeck; # or where you like it
- Create the directory for the installation.
mkdir -p $RDECK_BASE
- Copy the executable war to the installation directory. Example: rename rundeck-3.3.2-20200817.war to rundeck.war
cp rundeck-3.3.2-20200817.war $RDECK_WARS/rundeck.war
- Change directory and install the WAR.
cd $RDECK_BASE
java -server -Djava.net.preferIPv4Stack=true -Xmx4g -jar rundeck.war --installonly
- Now configure somethings. Add the line if yours doesn't have it
# Make your Rundeck server publicly
vi $RDECK_BASE/server/config/rundeck-config.properties
server.address=0.0.0.0
# Create new admin password, example 'MyAdminPass'
vi $RDECK_BASE/server/config/realm.properties
admin:MyAdminPass,user,admin,architect,deploy,build
# Add nodes by XML, YML, JSON configurations
vi $RDECK_BASE/etc/rundeck/rundeck-config.properties
rundeck.projectsStorageType=file
- Create Rundeck startup script on Ubuntu. It's using jenkins user.
sudo vi /etc/init.d/rundeck
NAME=rundeck
RUN_AS=jenkins
JAVA_HOME="/usr/lib/jvm/java-8-oracle"
JAVA_OPTS="-server -Xmn1g -Xms2g -Xmx2g -Djava.net.preferIPv4Stack=true -Dfile.encoding=UTF8 -Dhudson.model.DirectoryBrowserSupport.CSP="""
RDECK_BASE="/home/$RUN_AS/rundeck"
RDECK_WARS="/home/$RUN_AS/rundeck"
LOGFILE= $RDECK_BASE/rundeck.log
COMMAND="nohup $JAVA_HOME/bin/java $JAVA_OPTS -jar $RDECK_WARS/rundeck.war > $LOGFILE 2>&1 &"
. /lib/init/vars.sh
. /lib/lsb/init-functions
do_start()
{
su $RUN_AS -s /bin/bash -c "RDECK_BASE=$RDECK_BASE exec $COMMAND"
return 0
}
do_stop() {
# pkill -u $RUN_AS
kill -9 $(ps aux | grep java | grep rundeck | awk '{print $2}')
return 0
}
case $1 in
'start')
echo -n "Starting $DESC: $NAME"
do_start
echo "."
;;
'stop')
echo -n "Stopping $DESC: $NAME"
do_stop
echo "."
;;
'restart')
echo -n "Restarting $DESC: $NAME"
do_stop
sleep 1
do_start
echo "."
;;
*)
echo "usage: $NAME {start|stop|restart}"
exit 1
;;
esac
exit 0
- Make Rundeck service starts automatically
sudo chmod 755 /etc/init.d/rundeck
sudo chown root:root /etc/init.d/rundeck
sudo update-rc.d rundeck defaults
sudo update-rc.d rundeck enable
# Start your Rundeck service
sudo service rundeck start
- Check http://localhost:4440 and login by admin and "MyAdminPass"
Ref:
- https://docs.rundeck.com/docs/administration/install/jar.html
- https://www.techrepublic.com/article/how-to-add-remote-nodes-to-rundeck/
- https://tech.davidfield.co.uk/rundeck-3-install-setup-and-an-example-project/
Add node into Rundeck
- Create new Project if you don't have. Example MY_SERVERS
http://localhost:4440/resources/createProject
- Example, you add a new node for user jenkins at test.com. It uses SSH with user and password
- Create a key contains a username and its password
http://localhost:4440/menu/storage
# Key Type: password
# Enter text: password of user jenkins
# Name: jenkins
- Add node configuration template
http://localhost:4440/project/MY_SERVERS/nodes/sources#sources
- Choose button "Add a new Node Soruce"
- Choose File (Reads a file containing node definitions in a supported format)
- Format: resourcexml
- File Path: /home/jenkins/rundeck_config/node1.xml
- Genarete: checked. Automatically generate the file if it is missing
- Include Server Node: checked
- Require File Exists: un-check
- Writeable: checked.
- Click Save and Save
- A new XML file will be generated at /home/jenkins/rundeck_config/test_com_jenkins.xml
- Node you can edit it at http://localhost:4440/project/MY_SERVERS/nodes/sources
- Choose the Edit tab. Choose the File and Modify button.
Example: add a node test.com via SSH
<?xml version="1.0" encoding="UTF-8"?>
<project>
<node name="test_com"
hostname="test.com"
osFamily="unix"
ssh-authentication="password"
sudo-command-enabled="true"
username="jenkins"
ssh-password-storage-path="keys/jenkins"
tags="test,sudo"
/>
</project>