Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ANXS/nodejs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.0.0
Choose a base ref
...
head repository: ANXS/nodejs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Jul 30, 2014

  1. Copy the full SHA
    5e770fc View commit details

Commits on Sep 6, 2014

  1. Merge pull request #9 from umairsiddique/master

    Fix source.yml to work with Ansible 1.6.7
    pjan committed Sep 6, 2014
    Copy the full SHA
    4bad623 View commit details

Commits on Sep 26, 2014

  1. Replace Ansibles with ANXS

    Couto committed Sep 26, 2014
    Copy the full SHA
    a1ffa88 View commit details

Commits on Jan 24, 2015

  1. Merge pull request #15 from Couto/anxs

    Replace Ansibles with ANXS
    otakup0pe committed Jan 24, 2015
    Copy the full SHA
    7480171 View commit details

Commits on Jan 25, 2015

  1. initial vagrantfile

    Jonathan Freedman committed Jan 25, 2015
    Copy the full SHA
    8ebcc0b View commit details
  2. Copy the full SHA
    fc5308d View commit details

Commits on Feb 7, 2015

  1. Copy the full SHA
    f989ad0 View commit details
  2. Copy the full SHA
    c0b0a11 View commit details
  3. Copy the full SHA
    9363d32 View commit details
  4. Merge pull request #13 from jschaul/master

    Added binary installation option to download "binary" pre-compiled code from nodejs website
    otakup0pe committed Feb 7, 2015
    Copy the full SHA
    3cf074e View commit details
  5. Merge branch 'master' of github.com:ANXS/nodejs

    Jonathan Freedman committed Feb 7, 2015
    Copy the full SHA
    7e2a7b9 View commit details
  6. add install_method to vagrantfile and travis

    proper naming of vm hostname
    
    rename hostname in inventory as well
    Jonathan Freedman committed Feb 7, 2015
    Copy the full SHA
    bf5d1d0 View commit details

Commits on Feb 12, 2015

  1. Merge pull request #18 from otakup0pe/master

    vagrantfile, additional tests
    otakup0pe committed Feb 12, 2015
    Copy the full SHA
    613d822 View commit details

Commits on Mar 21, 2015

  1. Updated vagrant ip and idempotence test

    David Farrington committed Mar 21, 2015
    Copy the full SHA
    4a0e967 View commit details

Commits on Mar 23, 2015

  1. Bump IP to start sequencing at 1

    David Farrington committed Mar 23, 2015
    Copy the full SHA
    6e46edf View commit details

Commits on Apr 3, 2015

  1. Merge pull request #22 from ANXS/farridav/vagrantfile_and_testing

    Updated vagrant ip and idempotence test
    otakup0pe committed Apr 3, 2015
    Copy the full SHA
    fe78bcc View commit details

Commits on May 19, 2015

  1. Copy the full SHA
    4ade38f View commit details
  2. Changed test.yml so that it uses role dependencies and added requirem…

    …ents.yml to fetch them.
    mtpereira committed May 19, 2015
    Copy the full SHA
    4619980 View commit details

Commits on May 25, 2015

  1. Copy the full SHA
    20d2d7d View commit details
  2. Copy the full SHA
    beeca72 View commit details

Commits on Sep 10, 2015

  1. Set https for downloading packages

    Artem Prokopenko committed Sep 10, 2015
    Copy the full SHA
    8eef5e2 View commit details

Commits on Mar 14, 2016

  1. Copy the full SHA
    871eac7 View commit details

Commits on Apr 30, 2016

  1. Merge pull request #29 from loliee/refactor/node-unarchive

    Use unarchive module instead of tar when extracting node archive
    otakup0pe committed Apr 30, 2016
    Copy the full SHA
    05bb27a View commit details
  2. Merge pull request #28 from ArtemProkopenko/master

    Set https for downloading packages
    otakup0pe committed Apr 30, 2016
    Copy the full SHA
    c4586b4 View commit details
  3. Merge pull request #24 from mtpereira/alternatives

    Alternatives
    otakup0pe committed Apr 30, 2016
    Copy the full SHA
    404d1a7 View commit details
  4. Proper unarchive invocation

    Jonathan Freedman committed Apr 30, 2016
    Copy the full SHA
    51f22d0 View commit details
  5. Merge branch 'master' of github.com:anxs/nodejs

    Jonathan Freedman committed Apr 30, 2016
    Copy the full SHA
    a656fab View commit details

Commits on May 4, 2016

  1. Switched to nodesource

    soupdiver authored and David Farrington committed May 4, 2016
    Copy the full SHA
    f1c92d4 View commit details
  2. Swithc to role based testing, bump node to 0.10.44, use ansible facts…

    … rather than shell
    David Farrington committed May 4, 2016
    Copy the full SHA
    28dc212 View commit details
  3. Reflect build status of master in README badge, add but about testing…

    … setup
    David Farrington committed May 4, 2016
    Copy the full SHA
    8c39f77 View commit details
  4. Merge pull request #23 from ANXS/soupdiver/issue_10

    Switched to nodesource
    David Farrington committed May 4, 2016
    Copy the full SHA
    af85389 View commit details

Commits on Jan 17, 2018

  1. Copy the full SHA
    2da9c1f View commit details

Commits on Feb 14, 2018

  1. able to compile on macs now

    otakup0pe committed Feb 14, 2018
    Copy the full SHA
    83a31ab View commit details

Commits on Feb 19, 2018

  1. Copy the full SHA
    69484e2 View commit details
  2. Copy the full SHA
    7ef5a66 View commit details
  3. force edge group

    otakup0pe committed Feb 19, 2018
    Copy the full SHA
    3e8621f View commit details
  4. path debugging

    otakup0pe committed Feb 19, 2018
    Copy the full SHA
    f4dd8ef View commit details
  5. run tests in ubuntu 1604

    otakup0pe committed Feb 19, 2018
    Copy the full SHA
    4f687f0 View commit details

Commits on Feb 20, 2018

  1. proper dist syntax

    otakup0pe committed Feb 20, 2018
    Copy the full SHA
    684c33a View commit details
  2. Copy the full SHA
    56123ef View commit details
  3. use freshest nodejs

    otakup0pe committed Feb 20, 2018
    Copy the full SHA
    225c7db View commit details
  4. remove test vars

    otakup0pe committed Feb 20, 2018
    Copy the full SHA
    f29be2d View commit details

Commits on Feb 21, 2018

  1. Copy the full SHA
    d3a8d77 View commit details
  2. forgot the test yaml

    otakup0pe committed Feb 21, 2018
    Copy the full SHA
    7bfe637 View commit details

Commits on Feb 27, 2018

  1. updates, verbose, yolo

    otakup0pe committed Feb 27, 2018
    Copy the full SHA
    9a14e4c View commit details
  2. specify python interpreter

    otakup0pe committed Feb 27, 2018
    Copy the full SHA
    76478ed View commit details
  3. Copy the full SHA
    4b39d11 View commit details
  4. spell python properly ffs

    otakup0pe committed Feb 27, 2018
    Copy the full SHA
    f20aafb View commit details

Commits on Mar 8, 2018

  1. Copy the full SHA
    baa6d12 View commit details

Commits on Mar 28, 2018

  1. Copy the full SHA
    d72b6b8 View commit details
Showing with 270 additions and 100 deletions.
  1. +1 −9 .gitignore
  2. +17 −13 .travis.yml
  3. +34 −6 README.md
  4. +26 −0 Vagrantfile
  5. +2 −0 ansible.cfg
  6. +9 −5 defaults/main.yml
  7. +9 −7 meta/main.yml
  8. +26 −0 tasks/binary.yml
  9. +16 −9 tasks/main.yml
  10. +18 −10 tasks/package.yml
  11. +40 −39 tasks/source.yml
  12. +24 −0 tasks/update_path.yml
  13. +9 −2 test.yml
  14. +28 −0 tests/idempotence_check.sh
  15. +3 −0 tests/requirements.yml
  16. +2 −0 vagrant-inventory
  17. +6 −0 vars/main.yml
10 changes: 1 addition & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1 @@
.DS_Store
.AppleDouble
.LSOverride
Icon
._*
.Spotlight-V100
.Trashes
.vagrant
test
test.retry
30 changes: 17 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
---
language: python
python: "2.7"
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq python-apt python-pycurl
virtualenv:
system_site_packages: true
env:
- ROLE_OPTIONS="nodejs_install_method=source"
- ROLE_OPTIONS="nodejs_install_method=package"
- ROLE_OPTIONS="nodejs_install_method=binary"
install:
- pip install ansible==1.5.0
- sudo apt-get update -qq
- sudo apt-get install python-apt python-pycurl
- pip install -U ansible urllib3 pyOpenSSL pyasn1 ndg-httpsclient
- ansible-galaxy install -r tests/requirements.yml
script:
- echo localhost > inventory
- ansible-playbook --syntax-check -i inventory test.yml
- 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)
# Syntax check
- ansible-playbook -i inventory test.yml --syntax-check
# Play test
- travis_wait 30 ansible-playbook -i inventory test.yml --connection=local --become -e "$ROLE_OPTIONS" -e "ansible_python_interpreter=`which python`"
# Idempotence test
- ansible-playbook -i inventory test.yml --connection=local --become -e "$ROLE_OPTIONS" -e "ansible_python_interpreter=`which python`" | tee idempotence_out
- ./tests/idempotence_check.sh idempotence_out
40 changes: 34 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,50 @@
## Ansibles - nodejs [![Build Status](https://travis-ci.org/Ansibles/nodejs.png)](https://travis-ci.org/Ansibles/nodejs)
## ANXS - nodejs [![Build Status](https://travis-ci.org/ANXS/nodejs.png?branch=master)](https://travis-ci.org/ANXS/nodejs)

Ansible role for installing nodejs, from package or by building it from source.


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

- Tested on Ansible 2.3.2 or higher.
- Depends on ANXS.build-essential when using install_method of "source"

#### Variables

```yaml
nodejs_install_method: "source" # "package" or "source"
nodejs_version: "0.10.26" # nodejs version to install.
nodejs_install_method: "source" # "package" or "source" or "binary"
```
For "unstable" node versions (0.11), you may wish to use "binary" if you don't want to compile from source:
```yaml
nodejs_version: "0.11.13" # nodejs version to install.
nodejs_install_method: "binary" # "source" or "binary" (package is not available for 0.11)
```
#### 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

Once your VM is up, you can reprovision it using either `vagrant provision`, or `ansible-playbook tests/playbook.yml -i vagrant-inventory`

If you want to toy with the test play, see [tests/playbook.yml](./tests/playbook.yml), and change the variables in [tests/vars.yml](./tests/vars.yml)

If you are contributing, please first test your changes within the vagrant environment, (using the targeted distribution), and if possible, ensure your change is covered in the tests found in [.travis.yml](./.travis.yml)

#### Thanks to
- [Nicolas Bazire](https://github.com/nicbaz)
- [Luís Couto](https://github.com/Couto)
- [Stephan Hochhaus](https://github.com/yauh)
- [Nathan Palmer](https://github.com/nathanpalmer)
- [Manuel Tiago Pereira](https://github.com/mtpereira)
- [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
@@ -26,4 +54,4 @@ Licensed under the MIT License. See the LICENSE file for details.

#### Feedback, bug-reports, requests, ...

Are [welcome](https://github.com/ansibles/nodejs/issues)!
Are [welcome](https://github.com/ANXS/nodejs/issues)!
26 changes: 26 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

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

Vagrant.configure('2') do |config|
# Ensure we use our vagrant private key
config.ssh.insert_key = false
config.ssh.private_key_path = '~/.vagrant.d/insecure_private_key'

config.vm.define 'anxs' do |machine|
machine.vm.box = "hashicorp/trusty64"

machine.vm.network :private_network, ip: '192.168.88.17'
machine.vm.hostname = 'anxs.local'
machine.vm.provision 'ansible' do |ansible|
ansible.playbook = 'test.yml'
ansible.become = 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 ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[defaults]
roles_path = ../
14 changes: 9 additions & 5 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# file: nodejs/defaults/main.yml

---
nodejs_arch: "{{ansible_architecture}}"
nodejs_install_method: "source"
nodejs_version: "0.10.26"
nodejs_url: "http://nodejs.org/dist/v{{nodejs_version}}/node-v{{nodejs_version}}.tar.gz"
nodejs_prefix: "/usr/local/nodejs/node-v{{nodejs_version}}"
nodejs_version: "9.5.0"
nodejs_directory: "/usr/local/nodejs"
nodejs_source_url: "https://nodejs.org/dist/v{{nodejs_version}}/node-v{{nodejs_version}}.tar.gz"
nodejs_source_prefix: "{{nodejs_directory}}/node-v{{nodejs_version}}"
# possible achitectures: darwin-x64, darwin-x86, linux-x64, linux-x86, sunos-x64, sunos-x86
nodejs_binary_url: "https://nodejs.org/dist/v{{nodejs_version}}/node-v{{nodejs_version}}-{{ansible_system | lower}}-x{{ansible_userspace_bits |replace('32', '86')}}.tar.gz"
nodejs_system_paths: true
16 changes: 9 additions & 7 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# file: xxx/meta/main.yml

---
galaxy_info:
author: pjan vandaele
company: Ansibles
description: "Install nodejs, from package or build from source"
min_ansible_version: 1.4
company: ANXS
description: "Install nodejs, from package, build from source or download binary tarball"
min_ansible_version: 2.3.2
license: MIT
platforms:
- name: Ubuntu
@@ -15,5 +14,8 @@ galaxy_info:
- development

dependencies:
- role: Ansibles.build-essential
when: nodejs_install_method is defined and nodejs_install_method == "source"
- role: ANXS.build-essential
when: >
nodejs_install_method is defined and
nodejs_install_method == "source" and
ansible_os_family == 'Debian'
26 changes: 26 additions & 0 deletions tasks/binary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
- name: "Download the node.js binary for your distribution"
get_url:
url: "{{nodejs_binary_url}}"
dest: "/tmp/node-v{{nodejs_version}}.tar.gz"

- name: "Create node.js directory"
file:
path: "/usr/local/nodejs"
state: "directory"

- name: "Unpack the node.js package"
unarchive:
src : "/tmp/node-v{{nodejs_version}}.tar.gz"
dest : "/usr/local/nodejs"
copy : no

- name: "Update the symbolic link to the node.js install"
file:
path: "{{nodejs_directory}}/default"
src: "{{nodejs_binary_prefix}}"
state: "link"
force: yes

- include: update_path.yml

25 changes: 16 additions & 9 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
# file: nodejs/tasks/main.yml

---
- include: package.yml
when: nodejs_install_method == "package"

- name: node.js | Check if the node version is already installed
command: node --version
- name: Check if the node version is already installed
command: "{{nodejs_binary_prefix}}/bin/node --version"
ignore_errors: yes
register: node_version
changed_when: node_version.rc != 0 or node_version.stdout != "v{{ nodejs_version }}"
failed_when: no
register: nodejs_binary_version
changed_when: nodejs_binary_version.rc != 0 or nodejs_binary_version.stdout.find(nodejs_version) < 0
when: nodejs_install_method == "binary"
- name: Check if the node version is already installed
command: "{{nodejs_directory}}/node-v{{nodejs_version}}/bin/node --version"
ignore_errors: yes
failed_when: no
register: nodejs_source_version
changed_when: nodejs_source_version.rc != 0 or nodejs_source_version.stdout.find(nodejs_version) < 0
when: nodejs_install_method == "source"

- include: source.yml
when: nodejs_install_method == "source" and node_version.changed
when: nodejs_install_method == "source" and nodejs_source_version.changed
- include: binary.yml
when: nodejs_install_method == "binary" and nodejs_binary_version.changed
28 changes: 18 additions & 10 deletions tasks/package.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
# file: nodejs/tasks/package.yml

- name: node.js | Make sure the ansible required dependencies are installed
---
- name: "Make sure the ansible required dependencies are installed"
apt:
pkg: python-pycurl
state: present

- name: nodejs | Add the nodejs repository
apt_repository:
repo: ppa:chris-lea/node.js
- name: "add signing key"
apt_key:
url: "{{nodejs_apt_key_url}}"
id: "{{nodejs_apt_key}}"
state: present

- name: node.js | Install the node.js package
- name: "add sources.list entry"
lineinfile:
dest: /etc/apt/sources.list.d/nodesource.list
create: yes
line: "{{ item }}"
state: present
with_items:
- "deb {{nodejs_apt_url}} {{ansible_lsb.codename}} main"
- "deb-src {{nodejs_apt_url}} {{ansible_lsb.codename}} main"
- name: "Install the node.js package"
apt:
pkg: nodejs={{nodejs_version}}
package: "nodejs"
update_cache: yes
state: present
79 changes: 40 additions & 39 deletions tasks/source.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,53 @@
# file: nodejs/tasks/source.yml

- name: node.js | Make sure that the directory to hold the node.js binaries exists
---
- name: "Make sure that the directory to hold the node.js binaries exists"
file:
path: /usr/local/nodejs
path: "{{nodejs_directory}}"
state: directory
recurse: yes
mode: 0755

- name: node.js | Download the node.js source
- name: "Download the node.js source"
get_url:
url: "{{nodejs_url}}"
url: "{{nodejs_source_url}}"
dest: "/tmp/node-v{{nodejs_version}}.tar.gz"

- name: node.js | Unpack the node.js source
shell: tar -xvzf /tmp/node-v{{nodejs_version}}.tar.gz chdir=/tmp creates=/tmp/node-v{{nodejs_version}}

- name: node.js | Get the number of processors
- name: "Unpack the node.js source"
unarchive:
copy: no
src: "/tmp/node-v{{nodejs_version}}.tar.gz"
dest: "/tmp"
- name: "Get the number of processors (Linux)"
command: nproc
register: cpu_count

- name: node.js | Build node.js from source
register: cpu_count_linux
when: ansible_system == 'Linux'
changed_when: False
- name: "Get the number of processors (Darwin)"
command: sysctl -n hw.ncpu
register: cpu_count_darwin
when: ansible_os_family == 'Darwin'
changed_when: False
- name: "Set number of processors (Linux)"
set_fact:
cpu_count: "{{cpu_count_linux}}"
when: ansible_system == 'Linux'
changed_when: False
- name: "Set number of processors (Darwin)"
set_fact:
cpu_count: "{{cpu_count_darwin}}"
when: ansible_system == 'Darwin'
- name: "Check for artifact directory"
stat:
path: "/tmp/node-v{{nodejs_version}}/out/Release"
register: node_artifact_check
- name: "Build node.js from source"
shell: >
cd /tmp/node-v{{nodejs_version}} &&
./configure --prefix={{nodejs_prefix}} &&
./configure --prefix={{nodejs_source_prefix}} &&
make -j {{cpu_count.stdout}} &&
sudo make install
- name: node.js | Update the symbolic link to the node.js install
make install
when: not node_artifact_check.stat.exists
- name: "Update the symbolic link to the node.js install"
file:
path: /usr/local/nodejs/default
src: "{{nodejs_prefix}}"
path: "{{nodejs_directory}}/default"
src: "{{nodejs_source_prefix}}"
state: link
force: yes

- name: node.js | Add the node.js binary to the system path
lineinfile: "{{item}}"
with_items:
- dest=/etc/profile regexp='^NODE_HOME=/usr/local/nodejs/default' line="NODE_HOME=/usr/local/nodejs/default" state=present
- dest=/etc/profile regexp='^PATH=.*NODE_HOME.*' line="PATH=$PATH:$NODE_HOME/bin" state=present

- name: node.js | Inform the system where node is located and set this one as the default
shell: "{{item}}"
with_items:
- 'update-alternatives --install "/usr/bin/node" "node" "/usr/local/nodejs/default/bin/node" 1'
- 'update-alternatives --set node /usr/local/nodejs/default/bin/node'

- name: node.js | Inform the system where npm is located and set this one as the default
shell: "{{item}}"
with_items:
- 'update-alternatives --install "/usr/bin/npm" "npm" "/usr/local/nodejs/default/bin/npm" 1'
- 'update-alternatives --set npm /usr/local/nodejs/default/bin/npm'
- include: update_path.yml
24 changes: 24 additions & 0 deletions tasks/update_path.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
- name: "Add the node installation path to the system path"
lineinfile:
dest: /etc/profile
regexp: '^NODE_HOME={{ nodejs_directory }}/default'
line: 'NODE_HOME={{ nodejs_directory }}/default'
state: present
when: nodejs_system_paths
- name: "Add the node binary path to the system path"
lineinfile:
dest: /etc/profile
regexp: '^PATH=.*NODE_HOME.*'
line: 'PATH=$PATH:$NODE_HOME/bin'
state: present
when: nodejs_system_paths
- name: "Inform the system where the binaries are located and set as the default"
alternatives:
name: "{{ item }}"
path: "{{ nodejs_directory }}/default/bin/{{ item }}"
link: "/usr/bin/{{ item }}"
with_items:
- node
- npm
when: nodejs_system_paths
11 changes: 9 additions & 2 deletions test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
---

- hosts: all
remote_user: root
become: yes
vars_files:
- 'defaults/main.yml'
- "defaults/main.yml"
- "vars/main.yml"
roles:
- 'ANXS.build-essential'
tasks:
- include: 'tasks/main.yml'
- include: "tasks/main.yml"
28 changes: 28 additions & 0 deletions tests/idempotence_check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

# Process the output of the given file (should contain a plays stdout/err)
# If we pass, return with 0 else return with 1, and print useful output

_file="$1"

# Assert filename has been passed
[ $# -eq 0 ] && { echo "Usage: $0 filename"; exit 1; }

# Assert file exists
[ ! -f "$_file" ] && { echo "$0: $_file file not found."; exit 2; }

# Make sure nothing has changed or failed
grep -q 'changed=0.*failed=0' $_file

# Success condition
if [ $? -eq 0 ]; then
echo 'Idempotence test: pass'
exit

# Failure condition, extract useful information and exit
else
echo 'Idempotence test: fail'
echo ''
grep --color=auto -B1 -A1 "\(changed\|failed\):" $_file
exit 1
fi
3 changes: 3 additions & 0 deletions tests/requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---

- role: ANXS.build-essential
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.17 ansible_ssh_port=22 ansible_ssh_user=vagrant ansible_ssh_private_key_file=~/.vagrant.d/insecure_private_key
6 changes: 6 additions & 0 deletions vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
nodejs_apt_key_url: "https://keyserver.ubuntu.com/pks/lookup?op=get&fingerprint=on&search=0x1655A0AB68576280"
nodejs_apt_key: "68576280"
nodejs_binary_prefix: "{{nodejs_directory}}/node-v{{nodejs_version}}-{{ansible_system|lower}}-x{{ansible_userspace_bits|replace('32', '86')}}"
nodejs_major_version: "{{nodejs_version.split('.')[0]}}"
nodejs_apt_url: "https://deb.nodesource.com/node_{{nodejs_major_version}}.x"