title: Run npm and node from ansible
body: <p>I have a machine that has zsh installed.
  I created the following script to make some installs:</p>
  
  <p><strong>Installs made</strong></p>
  
  <pre><code># Install NVM
  sudo curl https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash
  ## Reload shell to start using nvm
  . ~/.zshrc
  . ~/.nvm/nvm.sh
  nvm install 0.12
  </code></pre>
  
  <p>Now I want to connect to the instance and run ansible-playbook that will start the following script:</p>
  
  <p><strong>sh-script.sh</strong></p>
  
  <pre><code>npm install aws-sdk
  
  
  node create-queue.js $machine_name
  node create-queue.js $machine_name
  </code></pre>
  
  <p>When running the playbook I get the following errors:
  line 28: npm: command not found --
  line 32: node: command not found --
  line 33: node: command not found.</p>
  
  <p>When I ssh to the instance and run "node" or "npm" I get valid response and desired condition.
  The ansible-playbook is very simple:</p>
  
  <p><strong>ansible</strong></p>
  
  <pre><code>- hosts: tag_Name_TestInstance
    tasks:
      - name: Run Script
        shell: /home/ubuntu/sh-script.sh '{{ machine_name }}'
  </code></pre>