Skip to content

Commit

Permalink
Merge pull request #22 from ANXS/farridav/vagrantfile_and_testing
Browse files Browse the repository at this point in the history
Updated vagrant ip and idempotence test
  • Loading branch information
otakup0pe committed Apr 3, 2015
2 parents 613d822 + 6e46edf commit fe78bcc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
10 changes: 1 addition & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,10 @@ 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 --syntax-check
- 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.
- >
ansible-playbook -i inventory test.yml --connection=local --sudo
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
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
5 changes: 2 additions & 3 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ nodejs_install_method = ENV.key?('NODEJS_INSTALL_METHOD') ? ENV['NODEJS_INSTALL_

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.17'
c.vm.hostname = 'anxs.local'
c.vm.provision 'ansible' do |ansible|
ansible.playbook = 'test.yml'
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.17 ansible_ssh_port=22

0 comments on commit fe78bcc

Please sign in to comment.