--- # Base role: OS updates, essential packages, Python/Miniconda - name: Update apt cache apt: update_cache: yes cache_valid_time: 3600 - name: Upgrade all packages apt: upgrade: dist autoremove: yes - name: Install essential system packages apt: name: - curl - wget - git - 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 shell: /bin/bash home: /opt/cezen create_home: yes groups: sudo append: yes - name: Create cezen directories file: path: "{{ item }}" state: directory owner: cezen group: cezen mode: "0755" loop: - /opt/cezen - /opt/cezen/models - /opt/cezen/data - /opt/cezen/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 command: bash /tmp/miniconda.sh -b -p /opt/cezen/miniconda args: creates: /opt/cezen/miniconda/bin/conda - name: Add conda to cezen PATH lineinfile: path: /opt/cezen/.bashrc line: 'export PATH="/opt/cezen/miniconda/bin:$PATH"' create: yes owner: cezen - name: Create cezen conda environment (Python 3.11) become_user: cezen command: /opt/cezen/miniconda/bin/conda create -n cezen python=3.11 -y args: creates: /opt/cezen/miniconda/envs/cezen - name: Install LangChain + LlamaIndex + HuggingFace in conda env become_user: cezen shell: | /opt/cezen/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