title: Add binaries to PATH with Ansible
body: <p>I'm trying to install the <a href="https://github.com/taylor/kiex" rel="nofollow noreferrer">Kiex</a> Version manager for the <a href="http://elixir-lang.org/install.html" rel="nofollow noreferrer">Elixir</a> programming language using Ansible.</p>
  
  <p>These are the plays I use for this:</p>
  
  <pre><code>- name: Kiex Installation
    hosts: web
    gather_facts: false
    remote_user: deployer
    tasks:
      - shell: \curl -sSL https://raw.githubusercontent.com/taylor/kiex/master/install | bash -s
      - name: Add Kiex Bin to Path
        lineinfile:
          dest: /home/deployer/.bashrc
          regexp: '^test -s'
          line: '[[ -s "$HOME/.kiex/scripts/kiex" ]] &amp;&amp; source "$HOME/.kiex/scripts/kiex"'
      - name: Reload Path
        shell: source /home/deployer/.bashrc
        args:
          executable: /bin/bash
      - shell: echo $PATH
        register: pathul
      - debug:
          var: pathul
  
  - name: Elixir Installation
    hosts: web
    gather_facts: false
    remote_user: deployer
    tasks:
      - shell: echo $PATH
        register: pathul
      - debug:
          var: pathul
      - name: Install Elixir Version
        command: /home/deployer/.kiex/bin/kiex list
        args:
          executable: /bin/bash
          chdir: /home/deployer/
      - name: Set Elixir Version as Default
        shell: kiex default 1.4
  </code></pre>
  
  <p>The Installation of Kiex is a success and if I log in to the remote Machine I am able to run it simply by using the <code>kiex</code> command. I can do this because I sourced the binaries in "~/.kiex/scripts/kiex". When I echo the <code>$PATH</code> variable it shows the kiex binaries path <code>/home/deployer/.kiex/bin</code> in it:</p>
  
  <pre><code>$ echo $PATH
  /home/deployer/.kiex/bin:/home/deployer/.kiex/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
  </code></pre>
  
  <p>However the <code>kiex</code>, <code>kiex list</code> and even the <code>/home/deoployer/.kiex/bin/kiex list</code> in the <strong>Elixir Installation</strong> Play shown above fail with the message:</p>
  
  <pre><code>TASK [Set Elixir Version as Default] *******************************************
  fatal: [local-web-2]: FAILED! =&gt; {"changed": true, "cmd": "kiex default 1.4", "delta": "0:00:00.002042", "end": "2017-01-26 22:13:32.898082", "failed": true, "rc": 127, "start": "2017-01-26 22:13:32.896040", "stderr": "/bin/sh: 1: kiex: not found", "stdout": "", "stdout_lines": [], "warnings": []}
  </code></pre>
  
  <p>Also the <code>pathul</code> variable that registered the result of echoing the path via ansible doesn't contain <code>/home/deployer/.kiex/bin</code>:</p>
  
  <pre><code>"stdout": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
  </code></pre>
  
  <p>How can I make the <code>kiex</code> command work properly via Ansible?</p>