- name: Install cgit community.general.openbsd_pkg: name: cgit state: present - name: Create cgit directories ansible.builtin.file: path: "{{ obsd_cgit_chroot }}{{ item }}" state: directory owner: www group: www mode: "0755" loop: - "{{ obsd_cgit_cache_dir }}" - "{{ obsd_cgit_htdocs_dir }}" - "{{ obsd_cgit_htdocs_dir }}/cgi-bin" - 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 static files into chroot htdocs dir ansible.builtin.copy: src: "{{ item }}" dest: "{{ obsd_cgit_chroot }}{{ obsd_cgit_htdocs_dir }}/{{ item }}" owner: www group: www mode: "0644" loop: - cgit.css - footer.html - name: Copy cgitrc configuration into chroot ansible.builtin.template: src: cgitrc.j2 dest: "{{ obsd_cgit_chroot }}/conf/cgitrc" owner: www group: www mode: "0644" - name: Compile markdown renderer into chroot ansible.builtin.include_tasks: markdown.yml - name: Deploy cgit post-receive hook ansible.builtin.copy: src: post-receive.d/cgit dest: "{{ obsd_cgit_hooks_dir }}/post-receive.d/cgit" owner: "{{ obsd_cgit_git_user }}" group: "{{ obsd_cgit_git_user }}" mode: "0755" - name: Enable slowcgi ansible.builtin.service: name: slowcgi enabled: true - name: Deploy cgit vhost fragment ansible.builtin.template: src: httpd.d/git.conf.j2 dest: "{{ obsd_httpd_conf_d }}/git.conf" owner: root group: wheel mode: "0644" notify: Reload httpd