Skip to content

Commit

Permalink
Merge pull request #18 from otakup0pe/master
Browse files Browse the repository at this point in the history
vagrantfile, additional tests
  • Loading branch information
otakup0pe committed Feb 12, 2015
2 parents 3cf074e + bf5d1d0 commit 613d822
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ install:
script:
- echo localhost > inventory
- ansible-playbook --syntax-check -i inventory test.yml
- ansible-playbook -i inventory -e nodejs_install_method=binary test.yml --connection=local --sudo
- >
ansible-playbook -i inventory -e nodejs_install_method=binary test.yml --connection=local --sudo
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
- ansible-playbook -i inventory test.yml --connection=local --sudo
# Taken from https://servercheck.in/blog/testing-ansible-roles-travis-ci-github
# Run the role/playbook again, checking to make sure it's idempotent.
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ Ansible role for installing nodejs, from package or by building it from source.

#### Requirements & Dependencies
- Tested on Ansible 1.4 or higher.
- Depends on ANXS.build-essential

- Depends on ANXS.build-essential when using install_method of "source"

#### Variables

Expand Down
22 changes: 22 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

nodejs_install_method = ENV.key?('NODEJS_INSTALL_METHOD') ? ENV['NODEJS_INSTALL_METHOD'] : 'source'

Vagrant.configure('2') do |config|
config.vm.define 'anxs' do |c|
c.vm.box = 'anxs-vbox-linux'
c.vm.box_url = 'http://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box'
c.vm.network :private_network, ip: '192.168.88.2'
c.vm.hostname = 'anxs.local'
c.vm.provision 'ansible' do |ansible|
ansible.playbook = 'test.yml'
ansible.sudo = true
ansible.inventory_path = 'vagrant-inventory'
ansible.host_key_checking = false
ansible.extra_vars = {
nodejs_install_method: nodejs_install_method
}
end
end
end
2 changes: 2 additions & 0 deletions vagrant-inventory
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[anxs]
anxs.local ansible_ssh_host=192.168.88.2 ansible_ssh_port=22

0 comments on commit 613d822

Please sign in to comment.