31
votes

OVERVIEW

I'd like to have reliable django deployments and I think I'm not following the best practices here. Till now I've been using fabric as a configuration management tool in order to deploy my django sites but I'm not sure that's the best way to go.

In the high performance django book there is a warning which says:

Fabric is not a configuration management tool. Trying to use it as one will ultimately cause you heartache and pain. Fabric is an excellent choice for executing scripts in one or more remote systems, but that's only a small piece of the puzzle. Don't reinvent the wheel by building your own configuration management system on top of fabric

So, I've decided I want to learn ansible.

QUESTIONS

  • Does it make sense using both fabric and ansible tools somehow?
  • Is it possible to use ansible from my windows development environment to deploy to production centos(6/7) servers?
  • There is this nice site https://galaxy.ansible.com/ which contains a lot of playbooks, any good recommendation to deploy django on centos servers?
1
Fabric and Ansible both enable orchestration in a similar fashion, so using both does not make sense as Fabric would be a subset of Ansible. The answer to the second question is yes. I do not know the third, so I leave this as a comment.Matt Schuchard
For question 2, it's not possible to use a Windows server as the control machine. You could run a virtual machine locally, and use ansible from there.Alasdair
@Alasdair I guess Matt Schuchard meant having ansible running on cygwin. Let's assume I'd use a virtual machine locally to deploy my stuff, what would be the main inconvenients of that approach (I'll develop my django sites on windows)? Fabric is fully multiplatform and that's great... If ansible is not the best choice for my use-case, any other good config management tool recommendation (windows on dev box & centos on production boxes)?BPL
Actually I think I was assuming using 'LINE' on Windows 10 (or maybe not). Otherwise, @Alasdair is probably correct on point 2.Matt Schuchard
@MattSchuchard To be honest, I'm really happy coding stuff on windows, I'm really productive on that platform and I code my stuff really fast. But of course, deploying such stuff on windows would be a pain. I'm using windows7 but if you tell me upgrading to windows10 will bring me a lot of advantages I could consider it of courseBPL

1 Answers

20
votes

Does it make sense using both fabric and ansible tools somehow?

Yes. All your logic should live in Ansible and you can use Fabric as a lightweight wrapper around it.

fab deploy

is easier to remember than, e.g.

ansible-playbook -v --inventory=production --tags=app site.yml

Is it possible to use ansible from my windows development environment to deploy to production centos(6/7) servers?

Sounds like you can't. Alternatively, If you use Fabric, it could copy your ansible playbooks up to a server (or pull directly from git) and run ansible from there.