Skip to content

Commit

Permalink
Add Ubuntu 16.04 support to tests
Browse files Browse the repository at this point in the history
Add a Ubuntu Xenial VM to the Vagrantfile configuration. Since Ubuntu 16.04 doesn't include python by default, we have to modify `site.yml` to use install it before running any Ansible modules.
  • Loading branch information
tnation14 committed Aug 23, 2017
1 parent e8c3f73 commit 5d69853
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.vagrant

*.log
*.retry
21 changes: 17 additions & 4 deletions examples/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,23 @@
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.define "trusty" do |trusty|
trusty.vm.box = "ubuntu/trusty64"
trusty.vm.hostname = "trusty64"

config.vm.provision "ansible" do |ansible|
ansible.playbook = "site.yml"
ansible.sudo = true
trusty.vm.provision "ansible" do |ansible|
ansible.playbook = "site.yml"
ansible.sudo = true
end
end

config.vm.define "xenial" do |xenial|
xenial.vm.box = "ubuntu/xenial64"
xenial.vm.hostname = "xenial64"

xenial.vm.provision "ansible" do |ansible|
ansible.playbook = "site.yml"
ansible.sudo = true
end
end
end
28 changes: 28 additions & 0 deletions examples/site.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,32 @@
---
- hosts: all
gather_facts: False

pre_tasks:

# Check Ubuntu release version to determine if we need to install Python 2,
# an ansible dependency that isn't included by default in Ubuntu 16.04 and
# up.

- name: Check Ubuntu release
raw: cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -d "=" -f2
register: ubuntu_release

- debug: msg="Running ubuntu version {{ ubuntu_release.stdout }}"

# Update apt cache and install python 2 for Ubuntu versions greater than 16.04
- name: Update APT cache
raw: apt-get update
become: True

- name: Install Python
raw: apt-get install -yq python
become: True
when: ubuntu_release.stdout | version_compare('16.04', '>=')

# Gather facts once ansible dependencies are installed
- name: Gather facts
setup:

roles:
- { role: "app.papertrail" }

0 comments on commit 5d69853

Please sign in to comment.