Ansible for the win

I've been a happy Puppet user until I get to know Ansible, after that I changed totally to Ansible. The reason why I changed is simple, I can run any playbooks from outside the target machine over ssh. I don't know if you, my dear reader, had the experience to install the puppet stuff in every machine which you worked, that simple task waste my time and get my machines dirt with deploy scripts, so I'm a happy Ansible user now.

Ansible's script is called playbook, the playbook is a yaml file, a sooooo simple file, without any tags or xml old style. You can configure module to create users, copy files through a template engine, etc.

You'll need a hosts file to tell which machine ansible will connect, after that, you'll only need to run ansible-playbook -i hosts my-yaml-playbook-file.yaml in your console.

As you improve you playbooks you'll fell the need to store your passwords using a more security solution, nevermind, ansible vault help you. It's simple you can reference environment variables from text files, the recommend approach to use ansible-vault is: Create a text file:


app_user: 'csantos'
app_pass: '{{ vault_app_password }}'

then, at the same var file's folder, through your bash terminal type ansible-vault create vault.yml, a editor like vim will open up, and you type vault_app_password: 'my_secret_password' close the file saving it and that's it, remember to reference those two var files, var.yml and vault.yml.

Take a quickly look on this repo, at the env/ folder, to see how things can be done.

I hope you enjoyed the reading, questions send me an e-mail.