Skip to content
Snippets Groups Projects
main.yml 1.11 KiB
Newer Older
  • Learn to ignore specific revisions
  • Daniel Müller's avatar
    Daniel Müller committed
    ---
    # 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
    
    Daniel Müller's avatar
    Daniel Müller committed
      become: true
      become_user: "{{ target_user }}"
    
      shell: ". /home/{{ target_user }}/.ml-venv/bin/activate && bash /tmp/tensorflow-install.sh"
    
      when: "tfinstalled.rc != 0"