Provisioning CoreOS with Ansible pip error
<p>I am trying to provision a coreOS box using Ansible. First a bootstapped the box using <a href="https://github.com/defunctzombie/ansible-coreos-bootstrap" rel="nofollow">https://github.com/defunctzombie/ansible-coreos-bootstrap</a></p>

<p>This seems to work ad all but pip (located in /home/core/bin) is not added to the path. In a next step I am trying to run a task that installs docker-py:</p>

<pre><code>- name: Install docker-py
  pip: name=docker-py  
</code></pre>

<p>As pip's folder is not in path I did it using ansible:</p>

<pre><code>  environment:
    PATH: /home/core/bin:$PATH
</code></pre>

<p>If I am trying to execute this task I get the following error:</p>

<p>fatal: [192.168.0.160]: FAILED! => {"changed": false, "cmd": "/home/core/bin/pip install docker-py", "failed": true, "msg": "\n:stderr: /home/core/bin/pip: line 2: basename: command not found\n/home/core/bin/pip: line 2: /root/pypy/bin/: No such file or directory\n"}</p>

<p>what I ask is where does <code>/root/pypy/bin/</code> come from it seems this is the problem. Any idea?</p>

<p>You can't use shell-style variable expansion when setting Ansible variables.  In this statement...</p>

<pre><code>environment:
  PATH: /home/core/bin:$PATH
</code></pre>

<p>...you are setting your <code>PATH</code> environment variable to the <em>literal</em> value <code>/home/core/bin:$PATH</code>.  In other words, you are blowing away any existing value of <code>$PATH</code>, which is why you're getting "command not found" errors for basic things like <code>basename</code>.</p>

<p>Consider installing <code>pip</code> somewhere in your existing <code>$PATH</code>, modifying <code>$PATH</code> <em>before</em> calling ansible, or calling <code>pip</code> from a shells cript:</p>

<pre><code>- name: install something with pip
  shell: |
    PATH="/home/core/bin:$PATH"
    pip install some_module
</code></pre>

python pip ansible ansible-playbook coreos