From d33f367c5fe5345d5d52db9079b8d7ed1ca72453 Mon Sep 17 00:00:00 2001 From: Menno van Leeuwen Date: Wed, 24 Sep 2025 16:10:44 +0200 Subject: [PATCH] Move Zed config to Ansible template with 1Password secrets --- ansible/tasks/workstations/symlinks.yml | 4 ---- ansible/tasks/workstations/workstation.yml | 3 +++ ansible/tasks/workstations/zed.yml | 20 +++++++++++++++++++ .../templates/zed.jsonc.j2 | 18 +++++++++++++++++ 4 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 ansible/tasks/workstations/zed.yml rename config/zed.jsonc => ansible/templates/zed.jsonc.j2 (89%) diff --git a/ansible/tasks/workstations/symlinks.yml b/ansible/tasks/workstations/symlinks.yml index 57e4197..f77c2a7 100644 --- a/ansible/tasks/workstations/symlinks.yml +++ b/ansible/tasks/workstations/symlinks.yml @@ -6,10 +6,6 @@ - name: Define workstation symlinks ansible.builtin.set_fact: workstation_symlinks: - - { - src: "$DOTFILES_PATH/config/zed.jsonc", - dest: "~/.config/zed/settings.json", - } - { src: "$DOTFILES_PATH/config/autostart", dest: "~/.config/autostart" } - name: Ensure parent directories for workstation symlinks exist diff --git a/ansible/tasks/workstations/workstation.yml b/ansible/tasks/workstations/workstation.yml index 5656170..8aa610d 100644 --- a/ansible/tasks/workstations/workstation.yml +++ b/ansible/tasks/workstations/workstation.yml @@ -4,6 +4,9 @@ - name: Include workstation symlinks tasks ansible.builtin.import_tasks: tasks/workstations/symlinks.yml + - name: Include Zed configuration tasks + ansible.builtin.import_tasks: tasks/workstations/zed.yml + - name: Include workstation cliphist tasks ansible.builtin.import_tasks: tasks/workstations/cliphist.yml when: "'microsoft-standard-WSL2' not in ansible_kernel" diff --git a/ansible/tasks/workstations/zed.yml b/ansible/tasks/workstations/zed.yml new file mode 100644 index 0000000..f6b555f --- /dev/null +++ b/ansible/tasks/workstations/zed.yml @@ -0,0 +1,20 @@ +--- +- name: Zed Configuration + block: + - name: Set user home directory + ansible.builtin.set_fact: + user_home: "{{ ansible_env.HOME if ansible_user_id == 'root' else lookup('env', 'HOME') }}" + + - name: Ensure Zed config directory exists + ansible.builtin.file: + path: "{{ user_home }}/.config/zed" + state: directory + mode: "0755" + + - name: Template Zed settings with 1Password secrets + ansible.builtin.template: + src: zed.jsonc.j2 + dest: "{{ user_home }}/.config/zed/settings.json" + mode: "0644" + tags: + - zed diff --git a/config/zed.jsonc b/ansible/templates/zed.jsonc.j2 similarity index 89% rename from config/zed.jsonc rename to ansible/templates/zed.jsonc.j2 index 0d0d20e..0506408 100644 --- a/config/zed.jsonc +++ b/ansible/templates/zed.jsonc.j2 @@ -10,6 +10,24 @@ // ############################################# // ## Theming ## // ############################################# + "context_servers": { + "mcp-server-context7": { + "source": "extension", + "enabled": true, + "settings": { + "context7_api_key": "{{ lookup('community.general.onepassword', 'Zed Settings', vault='Dotfiles', field='mcp-server-context7') }}" + } + }, + "memory": { + "source": "custom", + "enabled": true, + "command": "npx", + "args": ["-y", "@modelcontextprotocol/server-memory"], + "env": { + "MEMORY_FILE_PATH": "${input:memory_file_path}" + } + } + }, "features": { "edit_prediction_provider": "copilot" },