Skip to content
Ruby wrapper around Ansible
Ruby Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/workflows Tweak new functionality, augment tests Sep 24, 2019
bin Tweak new functionality, augment tests Sep 24, 2019
examples/streaming Tweak new functionality, augment tests Sep 24, 2019
lib Bump version, release 0.2.2 [ci skip] Sep 26, 2019
.gitignore Initial commit Jul 10, 2015
.rspec Initial commit Jul 10, 2015
Gemfile Initial commit Jul 10, 2015
LICENSE.txt Initial commit Jul 10, 2015
Rakefile Initial commit Jul 10, 2015

Ansible Wrapper

Gem Version Build Status Coverage Status Code Climate Documentation

A lightweight Ruby wrapper around Ansible that allows for ad-hoc commands and playbook execution. The primary purpose is to support easy streaming output.


Ensure Ansible is installed and available to shell commands i.e. in PATH. Tested with Ansible versions 2.0.2 thru 2.8.5 and Ruby 2.1+, but please create an issue if you use a version that fails.


Add this line to your application's Gemfile:

gem 'ansible-wrapper'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ansible-wrapper


Ad-hoc commands 'all -i localhost, --list-hosts' 'all -m shell -a "echo Test" -i localhost,'

Playbooks '-i localhost, spec/fixtures/mock_playbook.yml''-i localhost, spec/fixtures/mock_playbook.yml') # defaults to standard output'-i localhost, spec/fixtures/mock_playbook.yml') { |line_of_output| puts line_of_output }


To enable shortcuts:


You can then access Ansible via the A alias and use the following syntax:

A['all -i localhost, --list-hosts'] # alias for
A << '-i localhost, spec/fixtures/mock_playbook.yml' # alias for



After checking out the repo, run bin/setup to install dependencies. Then, run rake rspec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to


Bug reports and pull requests are welcome on GitHub at


The gem is available as open source under the terms of the MIT License.

You can’t perform that action at this time.