mirror of
https://github.com/fscotto/infra.git
synced 2026-05-30 15:39:58 +00:00
Manage VS Code extensions on deadalus
This commit is contained in:
@@ -74,6 +74,61 @@
|
||||
changed_when: true
|
||||
when: item.stdout | trim != item.item.value
|
||||
|
||||
- name: Check whether VS Code CLI is available on workstation host
|
||||
tags: [packages, vscode]
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- code
|
||||
- --version
|
||||
become_user: "{{ username }}"
|
||||
environment:
|
||||
HOME: "{{ user_home }}"
|
||||
register: workstation_vscode_cli
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
when: (deadalus_vscode_extensions | default([])) | length > 0
|
||||
|
||||
- name: Ensure VS Code CLI is available before managing extensions
|
||||
tags: [packages, vscode]
|
||||
ansible.builtin.fail:
|
||||
msg: Ensure Visual Studio Code is installed before managing VS Code extensions on deadalus.
|
||||
when:
|
||||
- (deadalus_vscode_extensions | default([])) | length > 0
|
||||
- workstation_vscode_cli.rc != 0
|
||||
|
||||
- name: Read installed VS Code extensions on workstation host
|
||||
tags: [packages, vscode]
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- code
|
||||
- --list-extensions
|
||||
become_user: "{{ username }}"
|
||||
environment:
|
||||
HOME: "{{ user_home }}"
|
||||
register: workstation_vscode_extensions_current
|
||||
changed_when: false
|
||||
when:
|
||||
- (deadalus_vscode_extensions | default([])) | length > 0
|
||||
- workstation_vscode_cli.rc == 0
|
||||
|
||||
- name: Install VS Code extensions on workstation host
|
||||
tags: [packages, vscode]
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- code
|
||||
- --install-extension
|
||||
- "{{ item }}"
|
||||
- --force
|
||||
become_user: "{{ username }}"
|
||||
environment:
|
||||
HOME: "{{ user_home }}"
|
||||
loop: "{{ deadalus_vscode_extensions | default([]) }}"
|
||||
loop_control:
|
||||
label: "{{ item }}"
|
||||
when:
|
||||
- workstation_vscode_cli.rc == 0
|
||||
- item not in (workstation_vscode_extensions_current.stdout_lines | default([]))
|
||||
|
||||
- name: Download workstation GNOME extension archives
|
||||
tags: [packages, gnome]
|
||||
ansible.builtin.get_url:
|
||||
|
||||
Reference in New Issue
Block a user