ansible-playbooks/roles/postgres/tasks/archlinux.yml
2025-11-11 00:02:15 +01:00

39 lines
1.1 KiB
YAML

---
- name: Check if pgvector is installed
ansible.builtin.command: pacman -Qi pgvector
register: pgvector_installed
changed_when: false
failed_when: false
- name: Install pgvector from AUR
when: pgvector_installed.rc != 0
block:
- name: Disable SUDOERS password prompt for AUR installation
no_log: true
ansible.builtin.lineinfile:
dest: /etc/sudoers
state: present
regexp: "^#?%wheel"
line: "%wheel ALL=(ALL) NOPASSWD: ALL"
validate: /usr/sbin/visudo -cf %s
- name: Install pgvector from AUR
become: false
ansible.builtin.command:
cmd: "paru -S --noconfirm pgvector"
- name: Restore SUDOERS password prompt after AUR installation
no_log: true
ansible.builtin.lineinfile:
dest: /etc/sudoers
state: present
regexp: "^#?%wheel"
line: "%wheel ALL=(ALL:ALL) ALL"
validate: /usr/sbin/visudo -cf %s
- name: Ensure PostgreSQL is initialized
ansible.builtin.command:
cmd: initdb -D {{ postgres_data_dir }}
creates: "{{ postgres_data_dir }}/PG_VERSION"
become_user: "{{ postgres_admin_user }}"