aboutsummaryrefslogtreecommitdiffstats
path: root/roles/git/tasks/cgit.yml
blob: fd9f549d47b6ba556ddc993251f9370d385347e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

- name: Install cgit dependencies
  apt: pkg={{ item }} state=installed
  with_items:
    - groff
    - libssl-dev
    - python-pip
  tags:
    - dependencies

- name: Install cgit pip dependencies
  pip: name={{ item }}
  with_items:
    - docutils
    - pygments

- name: Download cgit release
  get_url: url=http://git.zx2c4.com/cgit/snapshot/cgit-{{ cgit_version }}.tar.xz
           dest=/root/cgit-{{ cgit_version }}.tar.xz

- name: Decompress cgit source
  unarchive: src=/root/cgit-{{ cgit_version }}.tar.xz
             dest=/root copy=no
             creates=/root/cgit-{{ cgit_version }}/configure

- name: Build and install cgit
  shell: make get-git ; make ; make install
         executable=/bin/bash
         chdir=/root/cgit-{{ cgit_version }}
         creates=/var/www/htdocs/cgit/cgit.cgi

- name: Copy cgitrc
  template: src=etc_cgitrc.j2 dest=/etc/cgitrc
            group=www-data
            owner=root

- name: Rename existing Apache cgit virtualhost
  command: mv /etc/apache2/sites-available/cgit /etc/apache2/sites-available/cgit.conf removes=/etc/apache2/sites-available/cgit

- name: Remove old sites-enabled/cgit symlink (new one will be created by a2ensite)
  file: path=/etc/apache2/sites-enabled/cgit state=absent

- name: Configure the Apache HTTP server for cgit
  template: src=etc_apache2_sites-available_cgit.j2
            dest=/etc/apache2/sites-available/cgit.conf
            group=root
            owner=root

- name: Enable Apache CGI module
  command: a2enmod cgi creates=/etc/apache2/mods-enabled/cgi.load
  notify: restart apache

- name: Enable Apache rewrite module
  command: a2enmod rewrite creates=/etc/apache2/mods-enabled/rewrite.load
  notify: restart apache

- name:  Enable cgit site
  command: a2ensite cgit.conf creates=/etc/apache2/sites-enabled/cgit.conf
  notify: restart apache