Symfony with vagrant and ansible

1,968 views

Published on

Symfony with vagrant and ansible

  1. 1. Symfony development with Vagrant and Ansible Symfony User Group Belgium Meetup - http://symfonians.be January 2014
  2. 2. Me, myself and I Jean-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
  3. 3. 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.
  4. 4. Getting started with Vagrant • vagrant init mymachine http://files.vagrantup.com/ precise64.box • vagrant up • Vagrantfile • vagrant halt • vagrant destroy
  5. 5. 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
  6. 6. 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.
  7. 7. 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
  8. 8. Ansible with Vagrant config.vm.provision "ansible" do |ansible| ansible.playbook = "provisioning/playbook.yml" ansible.extra_vars = {private_interface: "192.168.100.1"} end
  9. 9. Ansible with Vagrant and Symfony
  10. 10. Symfony with Vagrant and Ansible https://github.com/symfonians/symfony-vagrant-ansible ! git clone https://github.com/symfonians/symfony-vagrant-ansible.git vagrant up
  11. 11. Thank you! jcc@pictawall.com - @totophe be.linkedin.com/in/totophe - github.com/totophe http://www.meetup.com/Symfony-User-Group-Belgium/

×