Symfony with vagrant and ansible

11
Symfony development with Vagrant and Ansible Symfony User Group Belgium Meetup - http://symfonians.be January 2014

Transcript of Symfony with vagrant and ansible

Page 1: Symfony with vagrant and ansible

Symfony development with Vagrant and Ansible

Symfony User Group Belgium Meetup - http://symfonians.be January 2014

Page 2: Symfony with vagrant and ansible

Me, myself and IJean-Christophe Cuvelier Partner @ Morris & Chapman Belgium Founder @ Pictawall.com

!• Web entrepreneur • Begun with a Commodore 64 • Creative PHP developer

! be.linkedin.com/in/totophe ! github.com/totophe ! @totophe

Page 3: Symfony with vagrant and ansible

Vagrant“Vagrant provides easy to configure, reproducible, and portable work environments built on top of industry-standard technology and controlled by a single consistent workflow to help maximize the productivity and flexibility of you and your team.” !Basically, Vagrant is a nice way to create virtual machines on the fly, and distribute a common configuration across multiple developers to avoid the “But it work on my machine” famous quote.

Page 4: Symfony with vagrant and ansible

Getting started with Vagrant

• vagrant init mymachine http://files.vagrantup.com/precise64.box

• vagrant up

• Vagrantfile

• vagrant halt

• vagrant destroy

Page 5: Symfony with vagrant and ansible

Some Vagrantfile recipes • Forwarding a local port:

config.vm.network :forwarded_port, guest: 80, host: 81

• Adding a dedicated private ip:

config.vm.network "private_network", ip: “192.168.100.100"

• Provisioning with a shell script:

config.vm.provision :shell, :path => “db.sh"

• Changing the memory for the virtual machine

config.vm.provider :virtualbox do |vb|

vb.customize ["modifyvm", :id, "--memory", "1024"]

end

Page 6: Symfony with vagrant and ansible

Ansible

“Ansible is the simplest way to automate.”

Ansible is a provisioning system that allows you to create recipes to build a specific environment and to replicate it on as many machines as you want. It allows you to build a very specific version of a system and to ensure that this configuration works with your project.

Page 7: Symfony with vagrant and ansible

Getting started with Ansible

• hosts file

• ansible all -m ping -i hosts

• ansible-playbook playbook.yml -i hosts

• ansible folder structure with tasks & templates using Yaml and Jinja2 (very similar to Twig*)

* Obviously, Twig is based on Jinja2

Page 8: Symfony with vagrant and ansible

Ansible with Vagrant

config.vm.provision "ansible" do |ansible|

ansible.playbook = "provisioning/playbook.yml"

ansible.extra_vars = {private_interface: "192.168.100.1"}

end

Page 9: Symfony with vagrant and ansible

Ansible with Vagrant and Symfony

Page 10: Symfony with vagrant and ansible

Symfony with Vagrant and Ansible

https://github.com/symfonians/symfony-vagrant-ansible

!

git clone https://github.com/symfonians/symfony-vagrant-ansible.git

vagrant up

Page 11: Symfony with vagrant and ansible

Thank [email protected] - @totophe

be.linkedin.com/in/totophe - github.com/totophe

http://www.meetup.com/Symfony-User-Group-Belgium/