Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
main.yml 1.11 KiB
---
# roles/ml-python-packages

- name: Install APT dependecies
  become: true
  apt:
    name:
      - libatlas-base-dev
    state: present

- name: Copy requirements.txt to remote fs
  copy:
    src: files/requirements.txt
    dest: /tmp/ml-requirements.txt

- name: Install ml python packages
  become: true
  become_user: "{{ target_user }}"
  pip:
    virtualenv_command: /usr/bin/python3 -m venv
    requirements: /tmp/ml-requirements.txt
    virtualenv: "/home/{{ target_user }}/.ml-venv"



- name: Check if tensorflow is installed (from wheel file)
  shell: ". /home/{{ target_user }}/.ml-venv/bin/activate && pip3 freeze | grep -q 'tensorflow @ file'"
  register: tfinstalled
  changed_when: "tfinstalled.rc != 0"
  failed_when: false

- name: Copy tf install script to remote fs
  copy:
    src: files/tensorflow-install.sh
    dest: /tmp/tensorflow-install.sh
  when: "tfinstalled.rc != 0"

- name: Download and install prebuilt tensorflow wheel
  become: true
  become_user: "{{ target_user }}"
  shell: ". /home/{{ target_user }}/.ml-venv/bin/activate && bash /tmp/tensorflow-install.sh"
  when: "tfinstalled.rc != 0"