diff options
Diffstat (limited to 'roles/cgit')
-rw-r--r-- | roles/cgit/defaults/main.yml | 7 | ||||
-rw-r--r-- | roles/cgit/meta/main.yml | 12 | ||||
-rw-r--r-- | roles/cgit/tasks/main.yml | 48 | ||||
-rw-r--r-- | roles/cgit/templates/conf-cgitrc.j2 (renamed from roles/cgit/templates/var-www-conf-cgitrc.j2) | 4 | ||||
-rw-r--r-- | roles/cgit/templates/conf-footer.html.j2 | 3 | ||||
-rw-r--r-- | roles/cgit/templates/etc-httpd.d-cgit.conf.j2 | 10 |
6 files changed, 34 insertions, 50 deletions
diff --git a/roles/cgit/defaults/main.yml b/roles/cgit/defaults/main.yml index ffbca1d..9fe8961 100644 --- a/roles/cgit/defaults/main.yml +++ b/roles/cgit/defaults/main.yml @@ -6,8 +6,12 @@ cgit_user: "git" cgit_group: "git" +cgit_instance: "cgit" + cgit_git_dir: "/data/git" -cgit_git_dir_chroot: "/htdocs/cgit" +cgit_chroot_dir: "/var/www" + +cgit_ip: 0.0.0.0 cgit_port: 1235 cgit_authenticate: false @@ -16,3 +20,4 @@ cgit__logo: "http://rgoncalves.se/logo.png" cgit__css: "http://rgoncalves.se/style/cgit.css" cgit__root_desc: "development hub" cgit__root_readme: "http://rgoncalves.se" +cgit__footer: "/conf/footer.html" diff --git a/roles/cgit/meta/main.yml b/roles/cgit/meta/main.yml index 02b67be..a25f289 100644 --- a/roles/cgit/meta/main.yml +++ b/roles/cgit/meta/main.yml @@ -1,9 +1,5 @@ - -# cgit ~~ roles/cgit/meta/main.yml -# Meta parameters - ---- - dependencies: - - { role: git, tags: "dependency" } - - { role: httpd_pre, tags: "dependency" } + - role: git + tags: dependency + - role: httpd_pre + tags: dependency diff --git a/roles/cgit/tasks/main.yml b/roles/cgit/tasks/main.yml index 6b52bd7..fa68415 100644 --- a/roles/cgit/tasks/main.yml +++ b/roles/cgit/tasks/main.yml @@ -1,21 +1,22 @@ - -# cgit ~~ roles/cgit/tasks/main.yml -# cgit web interface - ---- - - name: ensure cgit is installed package: name: cgit state: present -- name: generate cgit configuration file +- name: generate cgit configuration files template: - src: var-www-conf-cgitrc.j2 - dest: /var/www/conf/cgitrc + src: "{{ item.template }}" + dest: "{{ item.file }}" owner: "0" group: "0" mode: "0644" + loop: + - template: conf-cgitrc.j2 + file: "{{ cgit_chroot_dir }}/conf/cgitrc" + - template: conf-footer.html.j2 + file: "{{ cgit_chroot_dir }}/conf/footer.html" + - template: etc-httpd.d-cgit.conf.j2 + file: /etc/httpd.d/cgit.conf - name: generate cgit configuration for httpd template: @@ -28,7 +29,7 @@ - name: copy utility in httpd chroot copy: src: "/bin/{{ item }}" - dest: /var/www/bin + dest: "{{ cgit_chroot_dir }}/bin" mode: preserve remote_src: true loop: @@ -38,34 +39,11 @@ - name: copy about-filter generator copy: src: about-filter.sh - dest: /var/www/bin/about-filter.sh + dest: "{{ cgit_chroot_dir }}/bin/about-filter.sh" owner: "0" group: "0" mode: "0755" -- name: ensure cgit web directory exists - file: - path: /var/www/{{ cgit_git_dir_chroot }} - owner: "{{ cgit_user }}" - group: daemon - state: directory - mode: "0755" - -- name: include nfsclient for remote dir - include_role: - name: nfsclient - vars: - nfsclient_dir: "/var/www/{{ cgit_git_dir_chroot }}" - nfsclient_server_dir: "{{ global.nfs_server_dir }}/{{ ansible_host }}/git" - #nfsclient_server: "{{ global.nfs_server }}" - -- name: chown git directory to git - file: - path: /data/git - owner: "{{ cgit_user }}" - group: "{{ cgit_group }}" - state: directory - - name: start and enable slowcgi service service: name: slowcgi @@ -76,5 +54,5 @@ debug: msg: | Please provide a password using htpasswd, - in /htpasswd/cgit + in "{{ cgit_chroot_dir }}/htpasswd/cgit" when: cgit_authenticate diff --git a/roles/cgit/templates/var-www-conf-cgitrc.j2 b/roles/cgit/templates/conf-cgitrc.j2 index 8be36ce..1fc283f 100644 --- a/roles/cgit/templates/var-www-conf-cgitrc.j2 +++ b/roles/cgit/templates/conf-cgitrc.j2 @@ -6,6 +6,7 @@ css={{ cgit__css }} logo={{ cgit__logo }} favicon={{ cgit__favicon }} +footer={{ cgit__footer }} # readme readme=:README.md @@ -21,6 +22,7 @@ enable-http-clone=1 enable-index-links=1 max-stats=quarter robots=noindex, nofollow +localtime=1 # git clone-url=git://git.{{ global.domain_name }}/$CGIT_REPO_URL ssh://git@git.{{ global.domain_name }}/$CGIT_REPO_URL http://git.{{ global.domain_name }}/$CGIT_REPO_URL @@ -36,4 +38,4 @@ snapshots=tar.gz # sections section-from-path=1 section-sort=1 -scan-path={{ cgit_git_dir_chroot }} +scan-path={{ cgit_git_dir }} diff --git a/roles/cgit/templates/conf-footer.html.j2 b/roles/cgit/templates/conf-footer.html.j2 new file mode 100644 index 0000000..66ca627 --- /dev/null +++ b/roles/cgit/templates/conf-footer.html.j2 @@ -0,0 +1,3 @@ +<span style="background-color:yellow"> +remember that computers suck. +</span> diff --git a/roles/cgit/templates/etc-httpd.d-cgit.conf.j2 b/roles/cgit/templates/etc-httpd.d-cgit.conf.j2 index 6fb8e98..b77ca35 100644 --- a/roles/cgit/templates/etc-httpd.d-cgit.conf.j2 +++ b/roles/cgit/templates/etc-httpd.d-cgit.conf.j2 @@ -2,19 +2,19 @@ # httpd ~~ /etc/httpd.d/cgit.conf" # managed by Ansible -ext_ip="0.0.0.0" server "cgit" { - listen on $ext_ip port {{ cgit_port }} + listen on "{{ cgit_ip }}" port {{ cgit_port }} {% if cgit_authenticate %} authenticate "realm" with "/htpasswd/cgit" {% endif %} - # serve cgit static files directly: cgit.css and cgit.png + # cgit location "/cgit.*" { root "/cgit" - no fastcgi + no fastcgi } - # cgit CGI + + # fastcgi root "/cgi-bin/cgit.cgi" fastcgi socket "/run/slowcgi.sock" } |