#!/usr/bin/env ansible-playbook - name: Provision a vagrant machine hosts: '{{ myhost }}' vars: box: trusty64 tasks: - name: create a Vagrantfile command: vagrant init {{ box }} creates=Vagrantfile - name: Bring up a vagrant server command: vagrant up - name: add the Vagrant hosts to the inventory add_host: > name=vagrant ansible_ssh_host=127.0.0.1 ansible_ssh_port=2222 ansible_ssh_user=vagrant ansible_ssh_private_key_file=~/.vagrant.d/insecure_private_key - name: Do something to the vagrant machine hosts: vagrant sudo: yes tasks: # The list of tasks go below