Create easily your Ansible provisioning for Symfony, Laravel and Node.js projects.
This have been tested with the Ubuntu OS. It should work with many other various Debian distribution. Feel free to share your advice for the other OS.. This is what you will need to install if you haven't done yet:
- Python 2.7
- Ansible (>2.0)
- Vagrant I advise to download it from their website to have the last version.
- VirtualBox.
- nfs
sudo apt-get install nfs-kernel-server
- PyYAML and Jinja2 for python
-
Installation.
git clone [email protected]:fansible/tywin.git ~/tywin
-
Generate the default conf
You can generate the default conf by running in the root directory of your project:
python ~/tywin/generate.py
You can now find your provisioning in the devops
directory
-
Create the VM You can create the VM with
vagrant up
. -
Log in your vagrant with
vagrant ssh
and put your ssh key in the .ssh/authorized_keys file. Log out and try to log in again usingssh ubuntu@IP_OF_YOUR_VAGRANT (MAYBE 10.0.0.10 check your Vagrantfile)
If it's OK you can provision the VM
- Provision the VM
Provision it with ansible-playbook -i devops/provisioning/hosts/vagrant devops/provisioning/playbook.yml
.
If something goes wrong you can go inside your vagrant and try to execute manually in your shell the Ansible task that is failing.
After that, your VM is now ready! You can see your project in your browser at the IP's adress (10.0.0.10 if you haven't changed anything) =)
- Now you can do the same for your staging/production environment.
Update the file in
devops/provisioning/hosts/staging
and add the IP or domain of your server.
Change the value of the database configuration in devops/provisioning/group_vars/vagrant
What you can do:
-
Add your roles in the
devops/provisioning/roles
directory. -
Modify the playbook to call your roles.
-
Overide vars (in
devops/provisioning/vars
).
If you want to have more information on the use of Ansible/Vagrant for you development environment, I wrote a blog post about it.
If you have any question ask me on Twitter !