diff --git a/roles/homeassistant/defaults/main.yml b/roles/homeassistant/defaults/main.yml index 099a1c2..18655ed 100644 --- a/roles/homeassistant/defaults/main.yml +++ b/roles/homeassistant/defaults/main.yml @@ -20,3 +20,5 @@ ha_pg_db_pass: xxxxx ha_pg_grafana_db_name: grafana ha_pg_grafana_db_user: grafana ha_pg_grafana_db_pass: xxxxx + +ha_vscode_version: "4.96.2" diff --git a/roles/homeassistant/handlers/main.yml b/roles/homeassistant/handlers/main.yml index b3e8144..21c7d31 100644 --- a/roles/homeassistant/handlers/main.yml +++ b/roles/homeassistant/handlers/main.yml @@ -19,3 +19,8 @@ ansible.builtin.service: name: nginx state: restarted + +- name: Restart code-server + ansible.builtin.service: + name: code-server@{{ ha_user }} + state: restarted diff --git a/roles/homeassistant/tasks/main.yml b/roles/homeassistant/tasks/main.yml index 7e387e1..b3e5f81 100644 --- a/roles/homeassistant/tasks/main.yml +++ b/roles/homeassistant/tasks/main.yml @@ -12,4 +12,5 @@ - systemd.yml - installation.yml - grafana.yml + - vscode.yml - nginx.yml diff --git a/roles/homeassistant/tasks/vscode.yml b/roles/homeassistant/tasks/vscode.yml new file mode 100644 index 0000000..57a309a --- /dev/null +++ b/roles/homeassistant/tasks/vscode.yml @@ -0,0 +1,20 @@ +--- + +- name: Install VSCode + ansible.builtin.apt: + deb: https://github.com/coder/code-server/releases/download/v{{ ha_vscode_version }}/code-server_{{ ha_vscode_version }}_amd64.deb + +- name: Enable VSCode service + ansible.builtin.systemd_service: + name: code-server@{{ ha_user }} + state: restarted + enabled: true + +- name: Install config file + ansible.builtin.template: + src: config.yaml.j2 + dest: "/home/homeassistant/.config/code-server/config.yaml" + owner: homeassistant + group: homeassistant + mode: "0644" + notify: Restart code-server diff --git a/roles/homeassistant/templates/config.yaml.j2 b/roles/homeassistant/templates/config.yaml.j2 new file mode 100644 index 0000000..94cb5bb --- /dev/null +++ b/roles/homeassistant/templates/config.yaml.j2 @@ -0,0 +1,4 @@ +bind-addr: 127.0.0.1:8080 +auth: none +password: 0000 +cert: false