This tutorial explains how to deploy CGI scripts to the Rundeck instance. For example, this can be used to add a custom health check for a load balancer or define custom remote input options based on API calls.
These settings are valid for the rpm/deb or launcher install (for jetty container).
Edit the web.xml
In the launcher, the file web.xml is located on $RDECK_BASE/server/exp/webapp/WEB-INF. For deb/rpm installers, the web.xml is located in /var/lib/rundeck/server/exp/webapp/WEB-INF.
- Add the following attributes before the last “security-constraint” label (the one that contains the auth-constraint attribute). This will avoid the redirect to the login page if you are not logged in rundeck.
- After the last servlet attribute, add the following settings. A folder called WEB-INF/cgi-bin must be created (the name of the folder can be defined by the user)
- Add the following settings after the last “servlet-mapping” attribute. The “cgi-bin” name must match with the settings defined on the servlet.
Run the Script
With this settings, any script added to $RDECK_BASE/server/exp/webapp/WEB-INF/cgi-bin, can be called as an endpoint, for example:
- For the URL: http://localhost:4440/cgi-bin/somescript
- Will call the script $RDECK_BASE/server/exp/webapp/WEB-INF/cgi-bin/somescript