Skip to content

Instantly share code, notes, and snippets.

@willthames
Created March 22, 2014 00:57
Show Gist options
  • Save willthames/9699529 to your computer and use it in GitHub Desktop.
Save willthames/9699529 to your computer and use it in GitHub Desktop.
NPM improvements
- hosts: localhost
connection: local
tasks:
- npm: name="{{item}}" path="{{installdir}}/A" global=no
with_items:
- hubot
- coffee-script
- npm: name="{{item}}" path="{{installdir}}/B" global=no
with_items:
- coffee-script
- hubot
[will@cheetah ansible]$ cat npm_test_toplevel.yml
- hosts: localhost
connection: local
tasks:
- npm: name="{{item}}" path="{{installdir}}/A" global=no toplevel=yes
with_items:
- hubot
- coffee-script
- npm: name="{{item}}" path="{{installdir}}/B" global=no toplevel=yes
with_items:
- coffee-script
- hubot
[will@cheetah ansible]$ ansible-playbook npm_test_toplevel.yml -e installdir=/tmp/nodejs
PLAY [localhost] **************************************************************
GATHERING FACTS ***************************************************************
ok: [127.0.0.1]
TASK: [npm name="{{item}}" path="{{installdir}}/A" global=no toplevel=yes] ****
changed: [127.0.0.1] => (item=hubot)
changed: [127.0.0.1] => (item=coffee-script)
TASK: [npm name="{{item}}" path="{{installdir}}/B" global=no toplevel=yes] ****
changed: [127.0.0.1] => (item=coffee-script)
changed: [127.0.0.1] => (item=hubot)
PLAY RECAP ********************************************************************
127.0.0.1 : ok=3 changed=2 unreachable=0 failed=0
[will@cheetah ansible]$ ansible-playbook npm_test_toplevel.yml -e installdir=/tmp/nodejs
PLAY [localhost] **************************************************************
GATHERING FACTS ***************************************************************
ok: [127.0.0.1]
TASK: [npm name="{{item}}" path="{{installdir}}/A" global=no toplevel=yes] ****
ok: [127.0.0.1] => (item=hubot)
ok: [127.0.0.1] => (item=coffee-script)
TASK: [npm name="{{item}}" path="{{installdir}}/B" global=no toplevel=yes] ****
ok: [127.0.0.1] => (item=coffee-script)
ok: [127.0.0.1] => (item=hubot)
PLAY RECAP ********************************************************************
127.0.0.1 : ok=3 changed=0 unreachable=0 failed=0
[will@cheetah ansible]$ ls /tmp/nodejs/A/node_modules/.bin/
cake coffee hubot
[will@cheetah ansible]$ ls /tmp/nodejs/B/node_modules/.bin/
cake coffee hubot
[will@cheetah ansible]$ ansible-playbook npm_test.yml -e installdir=/tmp/nodejs
PLAY [localhost] **************************************************************
GATHERING FACTS ***************************************************************
ok: [127.0.0.1]
TASK: [npm name="{{item}}" path="{{installdir}}/A" global=no] *****************
changed: [127.0.0.1] => (item=hubot)
ok: [127.0.0.1] => (item=coffee-script)
TASK: [npm name="{{item}}" path="{{installdir}}/B" global=no] *****************
changed: [127.0.0.1] => (item=coffee-script)
changed: [127.0.0.1] => (item=hubot)
PLAY RECAP ********************************************************************
127.0.0.1 : ok=3 changed=2 unreachable=0 failed=0
[will@cheetah ansible]$ ls /tmp/nodejs/A/node_modules/.bin
hubot
[will@cheetah ansible]$ ls /tmp/nodejs/B/node_modules/.bin
cake coffee hubot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment