From 756dc388bedf97b68449e919a6730788f730c7b8 Mon Sep 17 00:00:00 2001 From: Ahmed Abdelhalim Date: Thu, 16 Jul 2026 14:39:19 +0200 Subject: Refactor pve cgit to use generic proxy This is refactoring the PoC for deploying cgit on pve, to now move to a more standard deployment with dedicated agnonstic proxy role/container --- roles/cgit/tasks/main.yml | 60 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 52 insertions(+), 8 deletions(-) (limited to 'roles/cgit/tasks/main.yml') diff --git a/roles/cgit/tasks/main.yml b/roles/cgit/tasks/main.yml index fed97fef..17a5675b 100644 --- a/roles/cgit/tasks/main.yml +++ b/roles/cgit/tasks/main.yml @@ -4,8 +4,7 @@ ansible.builtin.package: name: - cgit - - nginx - - fcgiwrap + - lighttpd - openssh state: present @@ -43,15 +42,61 @@ group: "root" mode: "0644" -- name: "Deploy nginx config" +- name: "Deploy lighttpd config" become: true ansible.builtin.template: - src: "cgit.nginx.conf.j2" - dest: "/etc/nginx/http.d/cgit.conf" + src: "cgit.lighttpd.conf.j2" + dest: "/etc/lighttpd/lighttpd.conf" owner: "root" group: "root" mode: "0644" - notify: "Restart nginx" + notify: "Restart lighttpd" + +- name: "Deploy caddy vhost on proxy" + when: hostvars[cgit_proxy_host]['proxy_type'] == "caddy" + delegate_to: "{{ cgit_proxy_host }}" + block: + - name: "Ensure caddy sites directory exists" + become: true + ansible.builtin.file: + path: "/etc/caddy/sites" + state: directory + owner: "root" + group: "caddy" + mode: "0750" + + - name: "Deploy caddy vhost" + become: true + ansible.builtin.template: + src: "cgit.caddy.j2" + dest: "/etc/caddy/sites/{{ cgit_hostname }}.caddy" + owner: "root" + group: "caddy" + mode: "0640" + notify: "Restart caddy" + +- name: "Deploy nginx vhost on proxy" + when: hostvars[cgit_proxy_host]['proxy_type'] == "nginx" + delegate_to: "{{ cgit_proxy_host }}" + block: + - name: "Ensure nginx vhosts directory exists" + become: true + ansible.builtin.file: + path: "/etc/nginx/vhosts.d" + state: directory + owner: "root" + group: "root" + mode: "0755" + + - name: "Deploy nginx vhost" + become: true + ansible.builtin.template: + src: "cgit.nginx.conf.j2" + dest: "/etc/nginx/vhosts.d/{{ cgit_hostname }}.conf" + owner: "root" + group: "root" + mode: "0644" + notify: "Restart nginx" - name: "Enable and start services" become: true @@ -60,6 +105,5 @@ enabled: true state: started loop: - - nginx - - fcgiwrap + - lighttpd - sshd -- cgit v1.2.3