Ansible's Rackspace Dynamic Inventory Plugin

The Rackspace dynamic inventory plugin is a powerful tool.


Installing inventory plugins isn’t intuitive, and the documentation available on this process isn’t immediately clear. The instructions found on this page Ansible Documentation can be adapted for the Rackspace plugin.

It boils down to this for the Rackspace plugin:

  1. Grab the latest version of from the plugins/inventory folder on GitHub. Raw GitHub Link
  2. Place this file on your Ansible master. The location doesn’t matter that much, but convention says to put it in /etc/ansible/
  3. Make this script executable by issuing chmod +x /etc/ansible/
  4. As the user that runs Ansible, create the following file at ~/.rackspace_cloud_credentials: (Be sure to replace the appropriate values with your Rackspace username and apikey.)
username = my_username
api_key = 01234567890abcdef

Target the script in your ansible run: ansible -i /etc/ansible/ webserver -m ping

Now your inventory is dynamic using Rackspace!