diff options
| author | Eugene Triguba <hello@eugenetriguba.com> | 2026-10-11 11:31:02 -0700 |
|---|---|---|
| committer | Eugene Triguba <hello@eugenetriguba.com> | 2026-10-11 18:36:51 -0700 |
| commit | 37304c0b775d3701318fcdb23f205ecddd47e6f0 (patch) | |
| tree | 339d5959d031adc6bb150db5dad1907a6bbd6aa8 /roles/obsd_cgit/tasks | |
| parent | Add support for downloading zip files of repo snapshots (diff) | |
| download | site-configs-37304c0b775d3701318fcdb23f205ecddd47e6f0.zip | |
Adjust cgit files to be located in /htdocs/cgit
Given I want to run multiple sites from this host, this should make it a
little clearer by having *most* of the related files all in one place.
We still have /conf/cgitrc and /cache/cgit, but I think that is okay and
clear enough.
Diffstat (limited to 'roles/obsd_cgit/tasks')
| -rw-r--r-- | roles/obsd_cgit/tasks/main.yml | 84 |
1 files changed, 64 insertions, 20 deletions
diff --git a/roles/obsd_cgit/tasks/main.yml b/roles/obsd_cgit/tasks/main.yml index ec79515..d04d80a 100644 --- a/roles/obsd_cgit/tasks/main.yml +++ b/roles/obsd_cgit/tasks/main.yml @@ -3,38 +3,82 @@ name: cgit state: present -- name: Deploy cgit vhost fragment - ansible.builtin.template: - src: httpd.d/cgit.conf.j2 - dest: "{{ obsd_httpd_conf_d | default('/etc/httpd.d') }}/cgit.conf" - owner: root - group: wheel - mode: "0644" - notify: Reload httpd - -- name: Create cgit cache directory +- name: Create cgit directorys ansible.builtin.file: - path: "/var/www{{ obsd_cgit_cache_dir }}" + path: "{{ obsd_cgit_chroot }}{{ item }}" state: directory owner: www - group: daemon + group: www mode: "0755" + loop: + - "{{ obsd_cgit_cache_dir }}" + - "{{ obsd_cgit_htdocs_dir }}" + - "{{ obsd_cgit_htdocs_dir }}/cgi-bin" -- name: Compile markdown renderer into chroot - ansible.builtin.include_tasks: markdown.yml +- name: Check if original cgi-bin exists + ansible.builtin.stat: + path: "{{ obsd_cgit_chroot }}/cgi-bin/cgit.cgi" + register: obsd_cgit_cgi_stat + +- name: Move cgi-bin file from installation to htdocs + ansible.builtin.copy: + src: "{{ obsd_cgit_chroot }}/cgi-bin/cgit.cgi" + dest: "{{ obsd_cgit_chroot }}{{ obsd_cgit_htdocs_dir }}/cgi-bin/cgit.cgi" + remote_src: true + owner: www + group: www + mode: "0755" + when: obsd_cgit_cgi_stat.stat.exists + +- name: Remove original cgit.cgi + ansible.builtin.file: + path: "{{ obsd_cgit_chroot }}/cgi-bin/cgit.cgi" + state: absent + +- name: Check if original cgit dir exists + ansible.builtin.stat: + path: "{{ obsd_cgit_chroot }}/cgit" + register: obsd_cgit_cgit_stat + +- name: Move cgit static files from installation to htdocs + ansible.builtin.copy: + src: "{{ obsd_cgit_chroot }}/cgit/*" + dest: "{{ obsd_cgit_chroot }}{{ obsd_cgit_htdocs_dir }}/" + remote_src: true + owner: www + group: www + mode: "0644" + when: obsd_cgit_cgit_stat.stat.exists + +- name: Remove original cgit static files + ansible.builtin.file: + path: "{{ obsd_cgit_chroot }}/cgit" + state: absent - name: Copy extra html head file into chroot ansible.builtin.copy: src: head.html - dest: /var/www/cgit/ - owner: root - group: daemon + dest: "{{ obsd_cgit_chroot }}{{ obsd_cgit_htdocs_dir }}" + owner: www + group: www mode: "0644" -- name: Deploy cgitrc configuration +- name: Copy cgitrc configuration into chroot ansible.builtin.template: src: cgitrc.j2 - dest: /var/www/conf/cgitrc + dest: "{{ obsd_cgit_chroot }}/conf/cgitrc" owner: www - group: daemon + group: www mode: "0644" + +- name: Compile markdown renderer into chroot + ansible.builtin.include_tasks: markdown.yml + +- name: Deploy cgit vhost fragment + ansible.builtin.template: + src: httpd.d/cgit.conf.j2 + dest: "{{ obsd_httpd_conf_d | default('/etc/httpd.d') }}/cgit.conf" + owner: root + group: wheel + mode: "0644" + notify: Reload httpd |