diff --git a/playbooks/apps/all.yaml b/playbooks/apps/all.yaml index 8f5ba48..7f2a3e9 100644 --- a/playbooks/apps/all.yaml +++ b/playbooks/apps/all.yaml @@ -2,6 +2,8 @@ - import_playbook: bin.yaml # noqa: name[play] - import_playbook: caddy.yaml # noqa: name[play] - import_playbook: charasheet.yaml # noqa: name[play] +- import_playbook: checkout.yaml # noqa: name[play] +- import_playbook: code.yaml # noqa: name[play] - import_playbook: ghost-update.yaml # noqa: name[play] - import_playbook: gitea.yaml # noqa: name[play] - import_playbook: goatcounter.yaml # noqa: name[play] diff --git a/playbooks/apps/code.yaml b/playbooks/apps/code.yaml new file mode 100644 index 0000000..53f31f7 --- /dev/null +++ b/playbooks/apps/code.yaml @@ -0,0 +1,52 @@ +--- +- name: Visual Studio Code + hosts: servers + gather_facts: false + tasks: + - name: Create dir + ansible.builtin.file: + path: "{{ dir }}" + state: directory + mode: "0775" + - name: Write files + ansible.builtin.copy: + src: "{{ item }}" + dest: "{{ dir }}/" + mode: preserve + with_fileglob: + - files/{{ app_name }}/* + - files/{{ app_name }}/.* + notify: + - Restart service + - name: Write templates + ansible.builtin.template: + src: "{{ item }}" + dest: "{{ dir }}/{{ item | basename | regex_replace('\\.j2$', '') }}" + mode: preserve + with_fileglob: + - templates/{{ app_name }}/*.j2 + - templates/{{ app_name }}/.*.j2 + notify: + - Restart service + - name: Ensure service is started + community.docker.docker_compose_v2: + project_src: "{{ dir }}" + state: present + + handlers: + - name: Restart service + community.docker.docker_compose_v2: + project_src: "{{ dir }}" + state: restarted + + vars: + app_name: code + dir: /mnt/data/{{ app_name }} + password: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 65333933333436616332666161653932633431333334636364346239346530336337303939643435 + 3935336230623135343638646130313936363034396665650a653066313862326632333130656164 + 38346631366162393833333361633663636362653530666466376162643534303866363261373033 + 6339303930656638660a626635313736663065373535613132326531343737396662626434373039 + 38646136383662346264613534373663326136393361323933383062346336346264643731303333 + 6132373439346165313066353334353532393262346435306134 diff --git a/playbooks/apps/files/code/docker-compose.yaml b/playbooks/apps/files/code/docker-compose.yaml new file mode 100644 index 0000000..eb6ffec --- /dev/null +++ b/playbooks/apps/files/code/docker-compose.yaml @@ -0,0 +1,11 @@ +services: + code: + image: ghcr.io/linuxserver/code-server + env_file: code.env + restart: always + volumes: + - ./code_data:/config + mem_limit: 3g + cpus: 3 + ports: + - "9002:8443" diff --git a/playbooks/apps/templates/code/code.env.j2 b/playbooks/apps/templates/code/code.env.j2 new file mode 100644 index 0000000..8510e67 --- /dev/null +++ b/playbooks/apps/templates/code/code.env.j2 @@ -0,0 +1,7 @@ +PUID=1000 +PGID=1000 +TZ=Europe/Paris +PASSWORD={{ password }} +SUDO_PASSWORD={{ password }} +PROXY_DOMAIN=code.augendre.info +DOCKER_MODS=linuxserver/mods:code-server-python3|linuxserver/mods:code-server-golang