Vagrant

Vagrantfile

  config.vm.provision "ansible_local" do |ansible|
    ansible.playbook = "playbook.yml"
    ansible.compatibility_mode = "2.0"
  end

playbook.yml

- hosts: all
  become: true

  tasks:
  - name: ensure repository key is installed
    apt_key:
      id: "58118E89F3A912897C070ADBF76221572C52609D"
      keyserver: "hkp://p80.pool.sks-keyservers.net:80"
      state: present
  
  - name: ensure docker registry is available
    # For Ubuntu 16.04 LTS
    apt_repository: repo='deb https://apt.dockerproject.org/repo ubuntu-xenial main' state=present
  
  - name: ensure docker and dependencies are installed
    apt: name={{ item }} update_cache=yes
    with_items:
      - docker-engine
      - docker-compose
  
  - name: add vagrant to docker group
    user: name=vagrant groups=docker append=yes
  
  - service: name=docker state=restarted