Skip to content

Commit

Permalink
Updated vagrant ip and idempotence test
Browse files Browse the repository at this point in the history
  • Loading branch information
David Farrington committed Mar 21, 2015
1 parent 613d822 commit 4a0e967
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
12 changes: 3 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
---
language: python
python: "2.7"
env:
- NODEJS_INSTALL_METHOD=binary
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq python-apt python-pycurl
install:
- pip install ansible==1.5.0
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 --syntax-check
- 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.
- >
ansible-playbook -i inventory test.yml --connection=local --sudo
| grep -q 'changed=0.*failed=0'
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ nodejs_install_method: "binary" # "source" or "binary" (package is not avail
- [Umair Siddique](https://github.com/umairsiddique)
#### Testing
This project comes with a VagrantFile, this is a fast and easy way to test changes to the role, fire it up with `vagrant up`

See [vagrant docs](https://docs.vagrantup.com/v2/) for getting setup with vagrant


#### License

Licensed under the MIT License. See the LICENSE file for details.
Expand Down
9 changes: 3 additions & 6 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
# -*- 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.box = 'ubuntu/trusty64'
c.vm.network :private_network, ip: '192.168.88.16'
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
nodejs_install_method: ENV.key?('NODEJS_INSTALL_METHOD') ? ENV['NODEJS_INSTALL_METHOD'] : 'source'
}
end
end
Expand Down
2 changes: 1 addition & 1 deletion vagrant-inventory
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[anxs]
anxs.local ansible_ssh_host=192.168.88.2 ansible_ssh_port=22
anxs.local ansible_ssh_host=192.168.88.16 ansible_ssh_port=22

0 comments on commit 4a0e967

Please sign in to comment.