99 lines
2.6 KiB
YAML
99 lines
2.6 KiB
YAML
---
|
||
# Base role: OS updates, essential packages, Python/Miniconda
|
||
- name: Update apt cache
|
||
apt:
|
||
update_cache: yes
|
||
cache_valid_time: 3600
|
||
|
||
- name: Upgrade all packages (this takes 10–20 min on first run, please wait...)
|
||
apt:
|
||
upgrade: dist
|
||
autoremove: yes
|
||
|
||
- name: Install essential system packages
|
||
apt:
|
||
name:
|
||
- curl
|
||
- wget
|
||
- git
|
||
- avahi-daemon
|
||
- build-essential
|
||
- ca-certificates
|
||
- gnupg
|
||
- lsb-release
|
||
- software-properties-common
|
||
- unzip
|
||
- htop
|
||
- net-tools
|
||
- jq
|
||
- python3-pip
|
||
- python3-venv
|
||
state: present
|
||
|
||
- name: Create cezen user
|
||
user:
|
||
name: "{{ cezen_user }}"
|
||
shell: /bin/bash
|
||
groups: sudo
|
||
append: yes
|
||
state: present
|
||
|
||
- name: Create cezen directories
|
||
file:
|
||
path: "{{ item }}"
|
||
state: directory
|
||
owner: "{{ cezen_user }}"
|
||
group: "{{ cezen_user }}"
|
||
mode: "0755"
|
||
loop:
|
||
- "{{ cezen_home }}"
|
||
- "{{ cezen_home }}/models"
|
||
- "{{ cezen_home }}/data"
|
||
- "{{ cezen_home }}/logs"
|
||
|
||
- name: Download Miniconda
|
||
get_url:
|
||
url: https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
|
||
dest: /tmp/miniconda.sh
|
||
mode: "0755"
|
||
retries: 3
|
||
delay: 10
|
||
|
||
- name: Install Miniconda
|
||
become_user: "{{ cezen_user }}"
|
||
command: bash /tmp/miniconda.sh -b -p {{ cezen_home }}/miniconda
|
||
args:
|
||
creates: "{{ cezen_home }}/miniconda/bin/conda"
|
||
|
||
- name: Add conda to cezen PATH
|
||
lineinfile:
|
||
path: "{{ cezen_login_home }}/.bashrc"
|
||
line: 'export PATH="{{ cezen_home }}/miniconda/bin:$PATH"'
|
||
create: yes
|
||
owner: "{{ cezen_user }}"
|
||
|
||
- name: Accept Anaconda Terms of Service (required since 2024)
|
||
become_user: "{{ cezen_user }}"
|
||
shell: |
|
||
{{ cezen_home }}/miniconda/bin/conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main
|
||
{{ cezen_home }}/miniconda/bin/conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r
|
||
changed_when: false
|
||
|
||
- name: Create cezen conda environment (Python 3.11)
|
||
become_user: "{{ cezen_user }}"
|
||
command: "{{ cezen_home }}/miniconda/bin/conda create -n cezen python=3.11 -y"
|
||
args:
|
||
creates: "{{ cezen_home }}/miniconda/envs/cezen"
|
||
|
||
- name: Install LangChain + LlamaIndex + HuggingFace in conda env (5–10 min, please wait...)
|
||
become_user: "{{ cezen_user }}"
|
||
shell: |
|
||
{{ cezen_home }}/miniconda/bin/conda run -n cezen pip install \
|
||
langchain langchain-community llama-index \
|
||
transformers huggingface-hub \
|
||
peft bitsandbytes accelerate \
|
||
fastapi uvicorn[standard] \
|
||
sentence-transformers
|
||
retries: 3
|
||
delay: 15
|