Search code examples
amazon-web-servicesansibleinventoryrundeck

Rundeck job with Ansible's dynamic inventory (ec2.py)


How do I configure Rundeck in a way that I can execute a job through Ansible over a couple of AWS Ec2 instances? I am using Batix plugin but i believe that it is not configured properly or some personal configuration is missing.

My idea is to trigger a job from Rundeck without defining static inventories on Rundeck and Ansible, if possible. (I add that Ansible + ec2.py and ec2.ini works properly without Rundeck)

Below a snippet of my the configuration file of inventory settings.

  • project.ansible-generate-inventory=true
  • resources.source.1.config.ansible-gather-facts=true
  • resources.source.1.config.ansible-ignore-errors=true
  • resources.source.1.config.ansible-inventory=/{{ VAR }}
  • resources.source.1.type=com.batix.rundeck.plugins.AnsibleResourceModelSourceFactory

for VAR I tried these values = etc/ansible/hosts ..... /ec2.py ..... /ec2.py -- list ..... /tmp/data/inventory


Solution

  • You can use Dynamic inventory under Rundeck, take a look at this GitHub thread. Another way is to create a node source like this. Alternatively, you can use the Rundeck EC2 plugin to get directly the AWS EC2 nodes. Take a look at this.