Skip to content

Instantly share code, notes, and snippets.

@bradfordpythian
Created December 19, 2016 21:23
Show Gist options
  • Save bradfordpythian/3549f29b5c0595465267086410624638 to your computer and use it in GitHub Desktop.
Save bradfordpythian/3549f29b5c0595465267086410624638 to your computer and use it in GitHub Desktop.
Install and update Ubuntu 10.04 via Vagrant
BOX="ubuntu-10.04"
if [ `vagrant box list | grep "^${BOX}" | wc -l` -eq 0 ]
then
vagrant box add ${BOX} http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-10.04_chef-provisionerless.box
fi
echo '# VagrantFile
Vagrant.configure(2) do |config|
config.vm.box = "'${BOX}'"
config.vm.provision "ansible" do |ansible|
ansible.verbose = "vvv"
ansible.playbook = "init.yml"
end
end' > Vagrantfile
echo '---
- hosts: all
become: yes
tasks:
- name: "Create inventory"
debug: msg="Inventory configured."' > init.yml
time vagrant up
vagrant status default
echo $?
INVENTORY=".vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory"
ls ${INVENTORY}
vagrant ssh -c 'uname -a'
echo $?
vagrant reload
vagrant ssh -c 'uname -a'
echo $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment