mirror of
https://github.com/fscotto/infra.git
synced 2026-05-30 15:39:58 +00:00
Add Ollama and Codex desktop integration
This commit is contained in:
@@ -124,6 +124,7 @@ profile_packages:
|
||||
- xournalpp
|
||||
- yaru
|
||||
- yaru-plus
|
||||
- zstd
|
||||
|
||||
desktop_common_dotfiles:
|
||||
- name: XDG autostart entries
|
||||
@@ -170,6 +171,10 @@ desktop_common_dotfiles:
|
||||
src: .config/opencode/
|
||||
dest: .config/opencode/
|
||||
mode: preserve
|
||||
- name: Codex config
|
||||
src: .codex/
|
||||
dest: .codex/
|
||||
mode: preserve
|
||||
- name: Turnstile user services
|
||||
src: .config/service/
|
||||
dest: .config/service/
|
||||
|
||||
@@ -510,6 +510,12 @@
|
||||
tags: [packages]
|
||||
ansible.builtin.set_fact:
|
||||
desktop_tools_tmp_dir: /tmp/desktop-tools
|
||||
ollama_asset: >-
|
||||
{{
|
||||
'ollama-linux-amd64.tar.zst' if ansible_facts['architecture'] == 'x86_64'
|
||||
else 'ollama-linux-arm64.tar.zst' if ansible_facts['architecture'] in ['aarch64', 'arm64']
|
||||
else ''
|
||||
}}
|
||||
gitmux_version: v0.11.5
|
||||
bw_version: 1.22.1
|
||||
opencode_asset_name: >-
|
||||
@@ -531,6 +537,12 @@
|
||||
msg: "Unsupported architecture {{ ansible_facts['architecture'] }} for OpenCode release binary"
|
||||
when: opencode_asset_name == ''
|
||||
|
||||
- name: Ensure architecture is supported for Ollama binary
|
||||
tags: [packages]
|
||||
ansible.builtin.fail:
|
||||
msg: "Unsupported architecture {{ ansible_facts['architecture'] }} for Ollama release binary"
|
||||
when: ollama_asset == ''
|
||||
|
||||
- name: Ensure architecture is supported for gitmux binary
|
||||
tags: [packages]
|
||||
ansible.builtin.fail:
|
||||
@@ -586,6 +598,20 @@
|
||||
checksum: "{{ opencode_asset.digest | default(omit) }}"
|
||||
mode: "0644"
|
||||
|
||||
- name: Download Ollama release archive
|
||||
tags: [packages]
|
||||
ansible.builtin.get_url:
|
||||
url: "https://ollama.com/download/{{ ollama_asset }}"
|
||||
dest: "{{ desktop_tools_tmp_dir }}/{{ ollama_asset }}"
|
||||
mode: "0644"
|
||||
register: ollama_archive_download
|
||||
|
||||
- name: Check whether Ollama is already installed
|
||||
tags: [packages]
|
||||
ansible.builtin.stat:
|
||||
path: /usr/local/bin/ollama
|
||||
register: ollama_binary
|
||||
|
||||
- name: Extract OpenCode release archive
|
||||
tags: [packages]
|
||||
ansible.builtin.unarchive:
|
||||
@@ -603,6 +629,32 @@
|
||||
group: root
|
||||
mode: "0755"
|
||||
|
||||
- name: Remove previous Ollama libraries
|
||||
tags: [packages]
|
||||
ansible.builtin.file:
|
||||
path: /usr/local/lib/ollama
|
||||
state: absent
|
||||
when:
|
||||
- ollama_archive_download.changed or not ollama_binary.stat.exists
|
||||
|
||||
- name: Extract Ollama release archive into /usr/local
|
||||
tags: [packages]
|
||||
ansible.builtin.shell: >-
|
||||
zstd -d -c "{{ desktop_tools_tmp_dir }}/{{ ollama_asset }}" |
|
||||
tar -xf - -C /usr/local
|
||||
args:
|
||||
executable: /bin/sh
|
||||
changed_when: true
|
||||
when:
|
||||
- ollama_archive_download.changed or not ollama_binary.stat.exists
|
||||
|
||||
- name: Install Codex CLI globally
|
||||
tags: [packages]
|
||||
community.general.npm:
|
||||
name: "@openai/codex"
|
||||
global: true
|
||||
state: present
|
||||
|
||||
- name: Set gitmux asset metadata
|
||||
tags: [packages]
|
||||
ansible.builtin.set_fact:
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
mode: "0755"
|
||||
- path: "{{ user_home }}/.local/runit/sv"
|
||||
mode: "0755"
|
||||
- path: "{{ user_home }}/.local/runit/sv/ollama"
|
||||
mode: "0755"
|
||||
- path: "{{ user_home }}/.local/runit/sv/ssh-agent"
|
||||
mode: "0755"
|
||||
- path: "{{ user_home }}/.local/state"
|
||||
@@ -46,6 +48,24 @@
|
||||
group: "{{ user_group }}"
|
||||
mode: "0755"
|
||||
|
||||
- name: Render per-user ollama runit service
|
||||
tags: [services, packages]
|
||||
ansible.builtin.template:
|
||||
src: ollama.run.j2
|
||||
dest: "{{ user_home }}/.local/runit/sv/ollama/run"
|
||||
owner: "{{ username }}"
|
||||
group: "{{ user_group }}"
|
||||
mode: "0755"
|
||||
|
||||
- name: Enable per-user ollama runit service
|
||||
tags: [services, packages]
|
||||
ansible.builtin.file:
|
||||
src: "../sv/ollama"
|
||||
dest: "{{ user_home }}/.local/runit/current/ollama"
|
||||
state: link
|
||||
owner: "{{ username }}"
|
||||
group: "{{ user_group }}"
|
||||
|
||||
- name: Enable per-user ssh-agent runit service
|
||||
tags: [services, packages]
|
||||
ansible.builtin.file:
|
||||
|
||||
5
ansible/roles/services_runit/templates/ollama.run.j2
Normal file
5
ansible/roles/services_runit/templates/ollama.run.j2
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
exec /usr/local/bin/ollama serve
|
||||
Reference in New Issue
Block a user