This is an alpha release! Use with caution.
Please report any errors or suggestions!
This plugin brings basic Ansible support to Rundeck. It imports hosts from Ansible's inventory, including a bunch of facts, and can run modules and playbooks. There is also a node executor and file copier for your project.
No SSH-Keys need to be shared between Ansible and Rundeck, everything is run through either ansible
or ansible-playbook
(even the node import).
The following bits are included:
Uses the default configured inventory to scan for nodes. Facts are discovered by default, but you can turn that off (although I highly recommend leaving it on).
Host groups are imported as tags, you can limit the import to just some selected patterns, if you want.
A bunch of facts are imported as attributes (sample screenshot).
This makes it possible to run commands via the "Commands" menu or the default "Command" node step in a job.
The command is passed to Ansible's shell
module. You can specify which shell to use in the project settings.
Enables usage of the default "Copy File" and (in combination with the above) "Script" node steps.
Files are transferred using Ansible's copy
module.
Run any Ansible module! You can specify the module name and arguments.
This is available as both a node and workflow step.
Note: The node step runs Ansible for every node, targeting only one node. The workflow step runs Ansible only once with a list of targets, so it should perform a bit better, if you don't need the individuality.
Run a playbook as a node or workflow step (see note above). You specify a path to a file, which must be accessible to Rundeck.
- Ansible executables in
$PATH
of Rundeck user - Rundeck user needs to be able to successfully run Ansible commands, that includes access to Ansible's config files and keys - it depends on your setup (whether you installed via .deb or launcher etc.)
- You can check if everything works with something like this:
su rundeck -s /bin/bash -c "ansible all -m ping"
- If it complains, chances are that your rundeck
$HOME
directory isn't writable by Rundeck, fix it with e.g.chown rundeck /var/lib/rundeck
(see this issue) - Another thing, if you have a special setup: Rundeck's environment might be missing some things, if you are using
su
or similar to start rundeck - maybe you need to tell it to use a login shell via-l
(see this issue) - If you are running CentOS 6.7 or similar (RHEL) or another system using SELinux, you may need to install libselinux-python (
yum install libselinux-python
) or disable SELinux on boot (see this issue)
- You can check if everything works with something like this:
- Download the .jar file from GitHub or compile it yourself (using Gradle, either your own the included wrapper)
- Copy the .jar file to your Rundeck plugins directory (
/var/lib/rundeck/libext
if you installed the .deb, for example) - Create a new project (this assumes you want every node in your project to be controlled via Ansible)
- Choose "Ansible Resource Model Source" as the resource model source
- Choose "Ansible Ad-Hoc Node Executor" as the default node executor
- Choose "Ansible File Copier" as the default node file copier
- Save, it can take a short time to import all the nodes, depending on your fleet
- You're all set! Try running a command
If anything goes wrong you can enable debugging for all components. Just enable the DEBUG log level for your jobs and add a Java system property named ansible.debug
with the value true
. You can do that for example in /etc/rundeck/profile
, make sure to restart your rundeck service.
This will print extra info either in some logs (e.g. /var/log/rundeck/service.log
) or the web console. If you file an issue, make sure to include as much information in your report as you can.
Discussions and pull requests are welcome.