Skip to content

Commit

Permalink
Update vagrant ubuntu version to 16.04
Browse files Browse the repository at this point in the history
Make corresponding changes to playbook and update README with correct
links to ansible.
  • Loading branch information
agschwender committed Oct 22, 2017
1 parent 87f602c commit 80ffd1b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -541,10 +541,10 @@ fork and then clone the project.

Packaged with Pilbox is a `Vagrant <http://www.vagrantup.com/>`_
configuration file which installs all necessary dependencies on a
virtual box using `Ansible <http://www.ansibleworks.com/>`_. See the
virtual box using `Ansible <https://www.ansible.com/>`_. See the
`Vagrant documentation <http://docs.vagrantup.com/v2/installation/>`_
and the `Ansible
documentation <http://www.ansibleworks.com/docs/gettingstarted.html#getting-ansible>`_
documentation <http://docs.ansible.com/ansible/latest/intro_installation.html>`_
for installation instructions. Once installed, the following will start
and provision a virtual machine.

Expand Down
34 changes: 20 additions & 14 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

bootstrap_script = <<EOT
sudo apt-get update
sudo apt-get install -y build-essential ansible
EOT

ansible_script = <<EOT
ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i /var/www/pilbox/provisioning/vagrant /var/www/pilbox/provisioning/playbook.yml
EOT

Vagrant.configure("2") do |config|
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "trusty64"
config.vm.box = "bento/ubuntu-16.04"

# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
# Disable random key creation
config.ssh.insert_key = false

# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
Expand All @@ -18,15 +26,13 @@ Vagrant.configure("2") do |config|
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
config.vm.synced_folder ".", "/var/www/pilbox", :owner => "vagrant"

# Enable provisioning with Ansible. Ansible playbooks are contained
# in a directory path relative to this Vagrantfile.
config.vm.provision :ansible do |ansible|
ansible.playbook = "provisioning/playbook.yml"
ansible.inventory_path = "provisioning/vagrant"
ansible.verbose = true
ansible.limit = 'all'
end
config.vm.synced_folder ".", "/var/www/pilbox", :owner => 'vagrant'

# The machine performs its own provisioning.
config.vm.provision 'shell', inline: bootstrap_script, privileged: false
config.vm.provision 'file', {
source: '~/.vagrant.d/insecure_private_key',
destination: '~/.ssh/id_rsa',
}
config.vm.provision 'shell', inline: ansible_script, privileged: false
end
1 change: 1 addition & 0 deletions provisioning/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
become: True

tasks:
- group: name=admin state=present
- user: name=ansible groups=admin shell=/bin/bash password=ansible state=present
- file: path=/etc/sudoers.d mode=0770 owner=root group=root state=directory
- copy: src=files/etc/sudoers dest=/etc/sudoers mode=0440 owner=root group=root
Expand Down

0 comments on commit 80ffd1b

Please sign in to comment.