# using Ansible for 100% of rails development

**URL:** <https://forum.ansible.com/t/using-ansible-for-100-of-rails-development/15444>\
**Category:** Ansible Project\
**Created:** [June 11, 2014, 5:07pm UTC](https://forum.ansible.com/t/using-ansible-for-100-of-rails-development/15444 "2014-06-11T17:07:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Weston\_Platter](https://avatars.discourse-cdn.com/v4/letter/w/ba8739/32.png) [@Weston\_Platter](https://forum.ansible.com/u/Weston_Platter)\
**Post date:** [June 11, 2014, 5:07pm UTC](https://forum.ansible.com/t/using-ansible-for-100-of-rails-development/15444/1 "2014-06-11T17:07:25Z")

</div>

I wanted to ask if anyone out there is using Ansible to provision servers and 100% deploy their Rails (rather than using Capistrano).

I saw a couple of posts/projects related to this:

- [https://mxey.net/deploying-rails-with-ansible/](https://mxey.net/deploying-rails-with-ansible/)

- [https://github.com/nicolai86/ansible-rails-deployment](https://github.com/nicolai86/ansible-rails-deployment)  
I’ve setup 20 or so Rails deployments with Capistrano. The current project that I’m working on uses upstart to manage the Rails sever/worker processes. As I’m having to push capistrano to handle more and more system level operations, I think putting it all in Ansible with my other server system configs would be a better separation of concerns. I’m the primary developer and don’t need to worry about giving non-system capable devs sudo access to servers.

Has anyone else run into this? Any pros/cons that run into after moving deployments to executed by Ansible?

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [June 11, 2014, 6:54pm UTC](https://forum.ansible.com/t/using-ansible-for-100-of-rails-development/15444/2 "2014-06-11T18:54:48Z")

</div>

Lots of people are using Ansible to replace Fabric or Capistrano and only get down to one tool - and those aren’t neccessarily Python or Ruby apps respect

(Ansible can also run things as non-root, so if you need to, that’s all cool)

I’ll let some folks using Rails chime in with details, though in general I think people get into the most trouble when they are trying to compile ruby via Ansible – it’s better to use a package manager to install something whenever you can and save all that build time – but you’d have that with Cap too.

The main thing is Ansible is order-based and makes it easy to say “if x is done here, do that”, which is something that is really hard to do in CM apps.

(Another is rolling updates)

---

<div class="post-metadata">

**Author:** ![Ryan\_Rix](https://avatars.discourse-cdn.com/v4/letter/r/eada6e/32.png) [@Ryan\_Rix](https://forum.ansible.com/u/Ryan_Rix)\
**Post date:** [June 12, 2014, 2:12am UTC](https://forum.ansible.com/t/using-ansible-for-100-of-rails-development/15444/3 "2014-06-12T02:12:00Z")

</div>

Weston Platter \<westonplatter@gmail.com\> writes:

> I wanted to ask if anyone out there is using Ansible to provision  
> servers and 100% deploy their Rails (rather than using Capistrano).
> 
> I saw a couple of posts/projects related to this:
> 
> \* [https://mxey.net/deploying-rails-with-ansible/](https://mxey.net/deploying-rails-with-ansible/)  
> \* [https://github.com/nicolai86/ansible-rails-deployment](https://github.com/nicolai86/ansible-rails-deployment)
> 
> I've setup 20 or so Rails deployments with Capistrano. The current  
> project that I'm working on uses upstart to manage the Rails  
> sever/worker processes. As I'm having to push capistrano to handle  
> more and more system level operations, I think putting it all in  
> Ansible with my other server system configs would be a better  
> separation of concerns. I'm the primary developer and don't need to  
> worry about giving non-system capable devs sudo access to servers.
> 
> Has anyone else run into this? Any pros/cons that run into after  
> moving deployments to executed by Ansible?

I'm a huge fan of managing rails deploys via Ansible. I found myself,  
like you, struggling to stretch Cap to fit my needs, whereas ansible  
makes all of this pretty simple. I'm working on open sourcing more of my  
deployment infrastructure, but here is one example, deploying Discourse  
outside their supported Docker install:

[https://github.com/nortonimperiallabs/infra/tree/master/roles/discourse](https://github.com/nortonimperiallabs/infra/tree/master/roles/discourse)

It's a fairly complex app with Sidekiq workers, and stuff, but Ansible  
makes it pretty much painless to manage deploying. In general, I've  
found it easiest to either ship my own Ruby RPMs and ignore things like  
RVM/rbenv. This role is used to deploy to a Fedora 20 box with Ruby  
2.0.0 on it, which is Good Enough that I don't have to worry about  
it. There is a fork of that repo or something that ports the Sidekiq  
workers to systemd jobs, and other system-level integration bits, too.

You can do some pretty cool things when you pair Ansible with Jenkins,  
which I don't think you really could do easily with Cap, like this  
little bit from AnsibleFest  
[https://docs.google.com/a/n.rix.si/presentation/d/1-AaITmG0\_d6O7NKXYb8ErOacvqBryFkEI7tHhb43uDo/pub?start%3Dfalse&loop%3Dfalse&delayms%3D3000#slide=id.g18178d75e\_094](https://docs.google.com/a/n.rix.si/presentation/d/1-AaITmG0_d6O7NKXYb8ErOacvqBryFkEI7tHhb43uDo/pub?start%3Dfalse&loop%3Dfalse&delayms%3D3000#slide=id.g18178d75e_094)  
(Slide 21 if the link explodes) that I realllllly want to try out soon.

Ryan
