From 7507031cb1365530333234b626ccc4b98a57a94d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20de=20Saint=20Martin?= Date: Tue, 8 May 2018 21:32:52 +0200 Subject: [PATCH] CoreOS bootstrap: set bin_dir and PATH for pip. --- roles/bootstrap-os/tasks/bootstrap-coreos.yml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/roles/bootstrap-os/tasks/bootstrap-coreos.yml b/roles/bootstrap-os/tasks/bootstrap-coreos.yml index be0030538..a1ea72cb8 100644 --- a/roles/bootstrap-os/tasks/bootstrap-coreos.yml +++ b/roles/bootstrap-os/tasks/bootstrap-coreos.yml @@ -7,23 +7,32 @@ tags: - facts +- name: Force binaries directory for Container Linux by CoreOS + set_fact: + bin_dir: "/opt/bin" + tags: + - facts + when: need_bootstrap.rc != 0 + - name: Bootstrap | Run bootstrap.sh script: bootstrap.sh when: need_bootstrap.rc != 0 - set_fact: - ansible_python_interpreter: "/opt/bin/python" + ansible_python_interpreter: "{{ bin_dir }}/python" tags: - facts - name: Bootstrap | Check if we need to install pip - shell: "{{ansible_python_interpreter}} -m pip --version" + shell: "pip --version" register: need_pip failed_when: false changed_when: false check_mode: no tags: - facts + environment: + PATH: "{{ ansible_env.PATH }}:{{ bin_dir }}" - name: Bootstrap | Copy get-pip.py copy: @@ -44,7 +53,7 @@ - name: Bootstrap | Install pip launcher copy: src: runner - dest: /opt/bin/pip + dest: "{{ bin_dir }}/pip" mode: 0755 when: need_pip.rc != 0 @@ -52,3 +61,5 @@ pip: name: "{{ item }}" with_items: "{{pip_python_coreos_modules}}" + environment: + PATH: "{{ ansible_env.PATH }}:{{ bin_dir }}"