Skip to content

Instantly share code, notes, and snippets.

@wsargent
Last active March 10, 2025 15:13
Show Gist options
  • Save wsargent/81f15cbcb46ea1ef72497e135d4511f7 to your computer and use it in GitHub Desktop.
Save wsargent/81f15cbcb46ea1ef72497e135d4511f7 to your computer and use it in GitHub Desktop.
pgvector install for letta
---
- hosts: all
become: true
vars:
postgres_version: "16"
postgres_password: ""
tasks:
- name: Install required packages
apt:
name:
- apt-transport-https
- ca-certificates
- curl
- software-properties-common
- python3-pip
- python3-psycopg2
- acl # required for postgres user changes https://github.com/georchestra/ansible/issues/55
state: present
update_cache: yes
- name: Install pgvector from source
become: yes
become_user: root
shell: |
apt-get update && apt-get install -y git build-essential postgresql-server-dev-{{ postgres_version }}
git clone https://github.com/pgvector/pgvector.git /tmp/pgvector
cd /tmp/pgvector && make && make install
args:
creates: /usr/lib/postgresql/{{ postgres_version }}/lib/vector.so
- block: # workaround, see https://stackoverflow.com/a/56558842
- name: PSQL installation and configuration
include_role:
name: anxs.postgresql
vars:
postgresql_apt_dependencies: ["python3-psycopg2", "locales"]
postgresql_version: "{{ postgres_version }}"
postgresql_users:
- name: letta
pass: "{{ postgres_password }}"
encrypted: yes
state: "present"
postgresql_database_extensions:
- db: letta
extensions:
- vector
postgresql_databases:
- name: letta
vector: true
state: "present" # optional; one of 'present', 'absent', 'dump', 'restore'
postgresql_user_privileges:
- name: letta # user name
db: letta # database
priv: "ALL" # privilege string format: example: INSERT,UPDATE/table:SELECT/anothertable:ALL
role_attr_flags: "CREATEDB,SUPERUSER" # role attribute flags
become: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment